[wp-trac] [WordPress Trac] #31566: Non-ASCII characters corrupted in mails sent using wp_mail on some systems

WordPress Trac noreply at wordpress.org
Sun Mar 8 23:12:25 UTC 2015


#31566: Non-ASCII characters corrupted in mails sent using wp_mail on some systems
--------------------------+-----------------------------
 Reporter:  codifex       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  4.1.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 A plugin sends mails using the wp_mail function.

 This works fine on all systems if ASCII-only characters are used in the
 message body. However, on one system it fails if non-ASCII characters are
 contained in the message body. Exactly the same WP version/configuration
 is used on all WP installs.

 I added a wp_mail hook and compared the values passed to wp_mail. They are
 exactly the same on both systems, see below. The message body contains the
 German words "Mücke" and "Österreich" (umlauts "ü" and "Ö").

 {{{
 array(5) { ["to"]=> string(16) "info at example.org" ["subject"]=> string(49)
 "=?utf-8?Q?Webformular:_Nachricht_von_M=C3=BCcke?=" ["message"]=>
 string(219) "Submitted on: 9. März 2015 Via: /kontakt/ By XXX.XX.XXX.XXX
 (visitor IP). Name: Mücke E-Mail-Adresse: info at example.org Ihre Nachricht:
 Österreich " ["headers"]=> array(8) { [0]=> string(36) "Date: Sun, 8 Mar
 2015 22:28:52 +0000" [1]=> string(46) "From: "info at example.org" " [2]=>
 string(0) "" [3]=> string(0) "" [4]=> string(26) "Reply-to:
 info at example.org" [5]=> string(13) "X-Priority: 3" [6]=> string(17) "MIME-
 Version: 1.0" [7]=> string(72) "Content-Transfer-Encoding: 8bitContent-
 Type: text/plain; charset="utf-8"" } ["attachments"]=> array(0) { } }
 }}}

 This mail is received when wp_mail is called with the above values on some
 WP installs:

 {{{
 [...]
 X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
 [...]
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bitContent-Type: text/plain; charset="utf-8"
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit

 [...]

 Name: Mücke
 E-mail: info at example.org
 Message: Österreich
 }}}

 Decoding works just fine and leads to a result containg the German workds
 "Mücke" and "Österreich".

 However, on one WP system the resulting mail looks like this:

 {{{
 [...]
 X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
 [...]
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bitContent-Type: text/plain; charset="utf-8"
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable

 [...]

 Name: M=C3=BCcke
 E-mail: test at example.org
 Message: =C3=96sterreich
 }}}

 Thunderbird and Roundcube are not able to decode this mail. The mail
 displayed in the mail clients contains the undecoded words "M=C3=BCcke"
 and "=C3=96sterreich".

 Why is 'Content-Transfer-Encoding: quoted-printable' used on one system?

 Potential sources of the problem:

 - Something in the server's PHPMailer configuration is wrong. Which config
 does WP expect? What has to be changed?

 - wp_mail is passing the wrong arguments to PHPMailer.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31566>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list