问题
I'm starting the server (on mac) this way:
python -m smtpd -n -c DebuggingServer localhost:9999
and i don't get any errors or any other notifications. I guess it means all is ok, correct me if i'm wrong.
But when i send emails from django shell or from my app, using send_mail/mail_managers with fail_silently=False, i dont see any output on smtpd debug server. I dont get any SMTPErrors, and send_mail/mail_managers returns 1.
I ran:
lsof -i | grep LISTEN
to see if anyone listens to port 9999, and nope, no one does. Does it mean that something wrong with smtp debug server? Is it supposed to show on the list of listeners?
My email settings:
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 9999
回答1:
I think you need to use the default smtp backend
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
来源:https://stackoverflow.com/questions/14019578/python-django-smtp-debugserver-doesnt-catch-emails