I have a Mezzanine project hosted in a droplet using smtp.gmail.com
as the host. I have a contact form that should send me an email when someone wants to inquire about more information. I get a 500 status code from Nginx when trying to send an email.
Here is when the problem occurs. To produce the problem, I go into my admin page in my Mezzanine project. I go to my Pages, and then select my form page called Contact. Inside this contact form page, I have a few options in the email section. In the from address: I put in a valid email. In the send mail to others: part, I put the same email. That way I am notified when someone sends an inquiry. This is how the problem is produced.
When I leave the send mail to others: part empty, the page works correctly. Although, I don’t get a notification. Here are things I’ve tried:
I have run the python manage.py shell
command to attempt sending mail that way, and it does successfully. I have also sent emails correctly when just running on my local machine.
I am assuming there is an issue with my droplets server not allowing outgoing emails? I have run the command: sudo ufw allow 587
and it still doesn’t allow me to send emails. Does anyone know what else I can do to further troubleshoot this issue?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Hi there @Chair,
I would recommend first checking your Nginx error log to see the actual error rather than the generic 500 error. To do that, you can first trigger the 500 error and then run the following command:
This should give you more information on what the actual problem is. Feel free to share the output here as well.
Another thing that I could suggest is to check if the outgoing TCP connections on port 587 are allowed:
Let me know how it goes! Regards, Bobby