Python/Django SMTP DebugServer doesn't catch e

2019-07-10 17:53发布

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条回答
【Aperson】
2楼-- · 2019-07-10 18:19

I think you need to use the default smtp backend

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
查看更多
登录 后发表回答