Sending SMTP email via Django in production environment
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 = 'myemail@gmail.com'
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开发者_StackOverflow社区 you
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.
精彩评论