Opened 9 years ago

Closed 9 years ago

#12648 closed (invalid)

[PATCH]User send_email change from send_mail to EmailMessage

Reported by: Kamil Gałuszka Owned by: Kamil Gałuszka
Component: contrib.auth Version: master
Severity: Keywords: send_mail, email, send_email, EmailMessage
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Simple workaround for not always working send_mail in method send_email in User class.
As the send_mail is deprecated. I change it to EmailMessage .

Attachments (1)

patch.diff (680 bytes) - added by Kamil Gałuszka 9 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by Kamil Gałuszka

Attachment: patch.diff added


comment:1 Changed 9 years ago by Kamil Gałuszka

Summary: User send_email change from send_mail to EmailMessage[PATCH]User send_email change from send_mail to EmailMessage

comment:2 Changed 9 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

Not sure I see the reason for this code churn. And send_mail() hasn't been deprecated.

comment:3 Changed 9 years ago by Kamil Gałuszka

Resolution: invalid
Status: closedreopened

Well i read here:

That send_email is deprecated. Even if no. Send_email is not working properly. Because it not deliever emails. I discover this bug in registration app when i was sending twice one mail. First with User.send_mail() that was using send_email and second with EmailMessage. To gmail this 2 mails was receive. But on other email hosting only email from EmailMessage was receive.

So I guess that send_email is not working always properly. Not for me. I tried it on two websites. Always send_email was working invalid.

comment:4 Changed 9 years ago by Russell Keith-Magee

Resolution: invalid
Status: reopenedclosed

Well, "Bryan" is wrong. As a word of advice, if Django deprecates something, you'll be able to find evidence of it on *our* website, and in *our* documentation.

As for email "not working" - you're going to need to be more a whole lot more specific than "working invalid". I have plenty of evidence that it is working fine.

comment:5 Changed 9 years ago by anonymous

Resolution: invalid
Status: closedreopened

Let's start from the beginning. I'm using django-registration developed by ubernostrum, in my django project.
Some time ago I had a problem with activation mail. It was simple, some(not every) email accounts wasn't receiving activation mail. It was very strange so I started searching what is the problem. I found that sending email was handled here:
And this line was the problem.

self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)

So I tried sending activation emails with EmailMessage. For me it was solution for problem, because magically emails where reaching destination email box(that previously don't reached that box).

Email account from which I was sending activation links, is on the same server where I have my django project. My settings:


Site is on mod_python. Hosting provider is .

If you have any question you are welcome. I think that send_email is buggy, I can provide more specific details if you want.

Some people on IRC said me that they have the same problem.

With regards

comment:6 Changed 9 years ago by Russell Keith-Magee

Resolution: invalid
Status: reopenedclosed

send_mail() is nothing but a light wrapper around EmailMessage. Your assertion that send_mail fails, but EmailMessage works doesn't make any sense.

*If* there is something going wrong, the problem is a lot more complex than what you're describing. However, I have lots of evidence that this is working fine, not the least of which is a fully passing test suite and production code that is successfully sending lots of mail.

So - I'm marking this invalid again. If you want to debug this, take it to Django-users. Once it has been nailed down to a *specific* problem, bring it back to Trac.

Note: See TracTickets for help on using tickets.
Back to Top