How to send email via Django?
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # Host for sending e-mail. EMAIL_HOST = 'localhost' # Port for sending e-mail. EMAIL_PORT = 1025 # Optional SMTP authentication information for EMAIL_HOST. EMAIL_HOST_USER = '' EMAIL_HOST_PASSWORD = '' EMAIL_USE_TLS = False
my email:
from django.core.mail import EmailMessage email = EmailMessage('Hello', 'World', to=['[email protected]']) email.send()
of course, if I setup a debugging server via
python -m smtpd -n -c DebuggingServer localhost:1025
, I can see the email in my terminal.