[Django]-Django send_mail get result

5👍

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)

4👍

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.

1👍

I would also suggest to use exceptions to find out whether email was sent or not.
If you haven’t time or option to set up an email server I would suggest to use django+gmail. U can create a ‘fake’ gmail account (create another one if you already own gmail-acc, it could be ‘baned’) and use its SMTP as a opportunity to send emails, even if you’re working with django’s development server (localy). How to is here

Leave a comment