Opened 15 years ago

Closed 15 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: dev
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

Description

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 15 years ago.
Patch

Download all attachments as: .zip

Change History (7)

by Kamil Gałuszka, 15 years ago

Attachment: patch.diff added

Patch

comment:1 by Kamil Gałuszka, 15 years ago

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

comment:2 by Russell Keith-Magee, 15 years ago

Resolution: invalid
Status: newclosed

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

comment:3 by Kamil Gałuszka, 15 years ago

Resolution: invalid
Status: closedreopened

Well i read here:
http://ltslashgt.com/2007/07/02/gmail-and-django/

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 by Russell Keith-Magee, 15 years ago

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 by anonymous, 15 years ago

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:
http://bitbucket.org/ubernostrum/django-registration/src/tip/registration/models.py
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:

EMAIL_HOST = '127.0.0.1'
EMAIL_HOST_USER = 'sponsorek@sponsorek.pl'
EMAIL_HOST_PASSWORD = '*****'
EMAIL_USE_TLS = False
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'sponsorek@sponsorek.pl'

Site is on mod_python. Hosting provider is linuxpl.com .

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
Galuszkak

comment:6 by Russell Keith-Magee, 15 years ago

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