3

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?

3 Answers 3

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.

0
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.