Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending SMTP email via Django in production environment

Tags:

django

I am using Django-Registration for my website on a linode ubuntu virtual. I get connection problem sending activation email when users sign up.

Here is my settings:

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_USE_TLS = True

I've tested locally and it works. I tested interactively via python manage.py shell on the host and it works when I logged in as root. I think there is a problem with permission since Apache is running under www-data. Do you have any ideas how to fix this?

EDIT: Someone on Linode IRC suggests that I install ssmtp package...I followed the instruction found here http://tombuntu.com/index.php/2008/10/21/sending-email-from-your-system-with-ssmtp/ and reboot the server...everything works great now.

Thank you

like image 644
John Lamber Avatar asked Nov 05 '09 18:11

John Lamber


1 Answers

Try setting

EMAIL_USE_TLS = 1

rather than EMAIL_USE_TLS = True. That's my guess. If that doesn't work, try

EMAIL_DEBUG = False

although honestly I'm not sure what that one does.

like image 61
John Debs Avatar answered Oct 22 '22 09:10

John Debs