Django

Code

Ticket #3472 (closed: fixed)

Opened 2 years ago

Last modified 1 month ago

Convince send_mail to not base64-encode the email

Reported by: Matthias Urlichs <smurf@smurf.noris.de> Assigned to: adrian
Milestone: Component: django.core.mail
Version: SVN Keywords: base64, send_mail
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

If you use utf8, mails will be base64-encoded by Python. That is a Bad Idea.

This patch tells it not to do that.

Attachments

email-as-qp.patch (1.9 kB) - added by Matthias Urlichs <smurf@smurf.noris.de> on 02/10/07 07:59:29.
Use quoted-printable, not base64, when mailing
email-as-qp.2.patch (379 bytes) - added by smurf@smurf.noris.de on 02/10/07 08:10:21.

Change History

02/10/07 07:59:29 changed by Matthias Urlichs <smurf@smurf.noris.de>

  • attachment email-as-qp.patch added.

Use quoted-printable, not base64, when mailing

02/10/07 08:10:21 changed by smurf@smurf.noris.de

  • attachment email-as-qp.2.patch added.

02/10/07 08:11:28 changed by smurf@smurf.noris.de

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Better patch: just replace the standard utf-8 charset.

The Subject: line seems to still be needlessly quoted-printable-encoded; I'll have to see what I can do about that. :-/

02/17/07 11:35:56 changed by Simon G. <dev@simon.net.nz>

  • keywords changed from base64 to base64, send_mail.
  • stage changed from Unreviewed to Ready for checkin.

02/25/07 23:47:12 changed by jacob

Can you explain to be *why* this change is needed? I don't like checking in code I don't understand :)

02/26/07 02:12:58 changed by smurf@smurf.noris.de

- It blows up the mail for no good reason. Some people still have to watch their bandwidth... - Many mail filters frequently don't MIME-decode emails. - SpamAssassin? and other filters assign a high score to base64-encoded mail, especially if the content is ASCII, because spammers use it to circumvent filters.

Reason enough? ;-)

04/05/07 18:46:19 changed by chris h.

I'd second the vote to add this patch... we ran into an issue with a vendor consuming our e-mail and not being able to decode the message even though other e-mail clients like GMail and Lotes Notes were fine with it.

04/23/07 03:39:04 changed by nick.lane.au@gmail.com

Perhaps the mime encoding type should be configured in the settings. Quoted-printable might not be the best choice for non-latin languages, while base64 may cause spam filter issues.

There is a ticket discussing this issue on trac's trac.

05/03/07 07:08:31 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5143]) Fixed #3472 -- Don't BASE64-encode UTF-8 (or ASCII) email messages. Patch from smurf@smurf.noris.de.

05/26/09 13:15:31 changed by phr

  • status changed from closed to reopened.
  • resolution deleted.

BTW, there's even better way to avoid unnecessary encoding:

from email import Charset 
Charset.add_charset('utf-8',Charset.SHORTEST,None,'utf-8')

The above will set Content-Transfer-Encoding to 7bit or 8bit as needed - exactly as Mutt or Thunderbird do.

05/26/09 13:19:19 changed by Alex

  • status changed from reopened to closed.
  • resolution set to fixed.

Please don't reopen tickets closed by core developers (especially ones closed 2 years ago), if you think this is still an issue file a *new* bug.


Add/Change #3472 (Convince send_mail to not base64-encode the email)




Change Properties
Action