This clarifies Benjamin's answer. One way to check email if I don't have a local mail server like postfix, sendmail or exim is to start the python mail server. You can run it on port 25 using sudo or just use port> 1024 (reserved ports):
python -m smtpd -n -c DebuggingServer localhost:1025 #sudo python -m smtpd -n -c DebuggingServer localhost:25
To test using your current django application code, you can temporarily change settings.py to include it in the bot:
EMAIL_HOST, EMAIL_PORT, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD = 'localhost', 1025, None, None
Now test your emails, or you can do it in a shell. /manage.py in another terminal window, for example:
python manage.py shell
And paste this code to send an email:
from django.core.mail import send_mail send_mail('Subject here', 'Here is the message.', 'messanger@localhost.com',['any@email.com'], fail_silently=False)
No need to use real emails, as you will see everything in your terminal. You can dump it into the appropriate container, for example .html, for further testing.
radtek Nov 13 '14 at 17:12 2014-11-13 17:12
source share