Python/Django SMTP DebugServer doesn't catch emails

試著忘記壹切 提交于 2019-12-12 18:28:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!