In my settings.py
, I have the following:
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 code:
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.
However, how do I actually send the email not to the debugging server but to [email protected]?
After reading your answers, let me get something straight:
Can't you use localhost(simple ubuntu pc) to send e-mails?
I thought in django 1.3 send_mail()
is somewhat deprecated and EmailMessage.send()
is used instead?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…