django send_mail get result
How can i get django send_mail result of email send. I run it local, i do send_mail to my email, a开发者_StackOverflow社区nd it return True, but letter not sended (because i have not any smtp set). But result is True. How to get real result?
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)
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.
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
精彩评论