Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django send_mail get result

Tags:

email

django

How can i get django send_mail result of email send. I run it local, i do send_mail to my email, and it return True, but letter not sended (because i have not any smtp set). But result is True. How to get real result?

like image 794
Evg Avatar asked Mar 24 '26 10:03

Evg


2 Answers

Django uses exceptions to handle email sending problems. The value returned by send_mail is the number of emails that were sent.

If you're not getting an exception, it could be one of a number of things:

  • You have fail_silently set to True (default is False)
  • You're using a different email backend (smtp is the default for 1.2+, the only option for earlier versions)
  • The mail is actually being sent, but something else is wrong (email server, bad email address, spam folders, gmail self-sent mail hiding etc)
like image 92
Will Hardy Avatar answered Mar 26 '26 00:03

Will Hardy


Use django-mailer. It puts the emails in the database and uses a cron-jobbed management command to send it out. It will help you track this issue down, improve your app response time, and also make your life easier.

like image 23
chefsmart Avatar answered Mar 26 '26 02:03

chefsmart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!