Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List-Unsubscribe & List-Id header values should not be encoded #2312

Closed
ferraro opened this issue Apr 12, 2021 · 2 comments
Closed

List-Unsubscribe & List-Id header values should not be encoded #2312

ferraro opened this issue Apr 12, 2021 · 2 comments

Comments

@ferraro
Copy link

ferraro commented Apr 12, 2021

Problem description

List-Unsubscribe & List-Id header values should not be encoded

Values will be encoded, mail clients like Apple Mail are unable than to read the values for the unsubscribe button.

Code to reproduce

$mail->addCustomHeader('List-Unsubscribe', "<mailto:...>");
$mail->addCustomHeader('List-Id', "123.list-id.".domain.tld>");

Debug output

List-Unsubscribe: =?us-ascii?Q?<mailto:unsubscribe=5Fstatus=5Freport\@api-dev.?=
 =?us-ascii?Q?trashmail.com=3Fsubject=3Did%3Dbe1115d2-a845-4f?=
 =?us-ascii?Q?c0-b5fa-f29c578f84ba>,_<https://dev.trashmail.c?=
 =?us-ascii?Q?om/=3Fcmd=3Dunsubscribe=5Fstatus=5Freport&id=3D?=
 =?us-ascii?Q?be1115d2-a845-4fc0-b5fa-f29c578f84ba>?=
List-Id: =?us-ascii?Q?be1115d2-a845-4fc0-b5fa-f29c578f84ba.list-id.de?=
 =?us-ascii?Q?v.trashmail.com>?=
@Synchro
Copy link
Member

Synchro commented Jun 23, 2021

Oddly, this behaviour in PHPMailer originated by copying exactly what Apple Mail does with long lines! This is standard RFC2047 encoding, and it's the only way you can wrap lines without introducing extra spaces when it's decoded. What other solution do you have for that?

@Synchro
Copy link
Member

Synchro commented Jul 11, 2021

The best workaround for this is to use SMTP to localhost instead of mail(), so add a call to isSMTP() to your code. This encoding is only done in order to avoid a bug in mail(), and although it's entirely RFC compliant, some email clients don't like it.

@Synchro Synchro closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants