WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#3717 closed defect (bug) (worksforme)

wp_mail does not correctly decode all MIME emails

Reported by: welcomb Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: General Keywords: wp-mail MIME
Focuses: Cc:

Description

wp_mail does not properly handle and decode MIME emails, especially multipart content type other than multipart/alternative.

Attachments (1)

3717.patch (2.2 KB) - added by welcomb 13 years ago.
My fix to the problem

Download all attachments as: .zip

Change History (9)

#1 @foolswisdom
14 years ago

Hi welcomb, thank you for the bug report!

Can you elaborate on how this problem manifests itself? What are the symptoms?

#2 @welcomb
14 years ago

  • Keywords wp-mail added; wp_mail removed

Emails with content type other than multipart/alternative does not get parsed properly by wp-mail.php.

If you examine the code (line 43), it only handles "multipart/alternative" explictly, and never gets the boundary string properly.

Also, it assumes that the text/plain section is the first message section (line 109) but it might not necessary be true.

As such, with emails encoded in other multipart formats, e.g. multipart/mixed, wordpress will dump the undecoded content of the mail into the blog post.

I would suggest incorpration of a MIME decoding library to properly handle MIME decoding. What I did was write a quick hack for it.

#3 @foolswisdom
13 years ago

  • Milestone changed from 2.2 to 2.3

welcomb, can you test and see if you are experiencing this issue on trunk? phpmailer was integrated.

#4 @welcomb
13 years ago

I'm still getting my emails not decoded properly. Here's what displayed in the post:

--SE947567
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Test test.
--SE947567

When it should have just extracted the text and shown "Test test."

@welcomb
13 years ago

My fix to the problem

#5 @cfactor
13 years ago

  • Cc cfactor added

#6 @Nazgul
13 years ago

  • Keywords has-patch needs-testing added

#7 @foolswisdom
13 years ago

  • Milestone changed from 2.3 to 2.4
  • Priority changed from low to normal

Are you still seeing this problem? I know that there has been other tickets working in this area.

#8 @darkdragon
13 years ago

  • Keywords has-patch needs-testing removed
  • Milestone 2.5 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

You can change the content-type by using a filter.

Note: See TracTickets for help on using tickets.