Question Details

No question body available.

Tags

php email html-email

Answers (2)

February 3, 2026 Score: 1 Rep: 52,794 Quality: Medium Completeness: 80%

Simple fix: Use Content-Transfer-Encoding: 7bit in place of Content-Transfer-Encoding: Quoted-Printable.

Because you have specified Quoted-Printable encoding, equal signs take on special meaning. An equal sign is expected to be followed by two hex characters, and that sequence represents a single 8-bit byte with that hex value. Equal signs themselves are supposed to be rewritted as =3D where 0x3D is the ASCII code for the equal sign.

As such, the body of the MIME part you've constructed is full of encoding errors, and different systems will interpret it differently. Here, the =ed is being interpreted as an 0xED byte. Because the content type character set is UTF-8, this is actually invalid. In correct UTF-8 encoded text, an 0xED byte must be followed by two bytes with values between 0x80 and 0xBF. Gmail is discarding the 0xED byte. Apple Mail has replaced it with the Unicode character "�" (U+FFFD) REPLACEMENT CHARACTER and then encoded that character using UTF-8 (byte sequence 0xef 0xbf 0xbd) and then percent-encoded that into the "%EF%BF%BD" sequence you're seeing. YIKES!

Anyway, assuming you aren't actually generating HTML with non-ASCII characters, using Content-Transfer-Encoding: 7bit will ensure that the "raw" 7-bit character stream is interpreted as-is.

February 3, 2026 Score: 1 Rep: 198 Quality: Low Completeness: 70%

You are sending a message with the Content-Transfer-Encoding: Quoted-Printable header.

This means everything that starts with = will be considered an escape to insert hexadecimal characters.

=ed will be translated to í in single byte codification ISO-8859-1. Then it is being translated to %EF%BF%BD by the email server since í is a non ASCII character.

I think that is better to use quotedprintableencode before sending the message content.

Not that you can't use Content-Transfer-Encoding: Quoted-Printable. Just use the proper PHP function to encode the data.