Krishnan Venkiteswaran
Krishnan Venkiteswaran

Reputation: 636

Header encoding issues with Mailkit and Mimekit

When I use Mailkit to send emails, I noticed that it automatically decides to encode both the content as well as headers. Now, the content encoding is perfect however some email clients have difficulty decoding the headers which are like.

Is there a way to instruct the client to not encode certain headers?. List-Unsubscribe: =?us-ascii?q?=3Chttps=3A=2F=2Fbarlinkar=2Eus19=2Elist-manage=2Ecom=2Funsubscribe=3Fu=3D8c60690?= =?us-ascii?q?5a7e637766f218816b&id=3D2e47bac84d&e=3D407e758886&c=3De27229afde=3E=2C?= =?us-ascii?q?_=3Cmailto=3Aunsubscribe-mc=2Eus19=5F8c606905a7e637766f218816b=2Ee27229a?= =?us-ascii?q?fde-407e758886=40mailin=2Emcsv=2Enet=3Fsubject=3Dunsubscribe=3E?= X-Report-Abuse: =?us-ascii?q?=3Chttps=3A=2F=2Fmailchimp=2Ecom=2Fcontact=2Fabuse=2F=3Fu=3D8c606905a7e637766f218?= =?us-ascii?q?816b&id=3De27229afde&e=3D407e758886=3E?= To: k****@****.***

EDIT: Jstedfast pointed out some errors and I fixed them but the overall result is the same.

Upvotes: 1

Views: 1011

Answers (1)

jstedfast
jstedfast

Reputation: 38538

I doubt the problem is that the header value is encoded. Your value is invalid to begin with.

Here's the raw value that you are using:

https://barlinkar.us19.list-manage.com/unsubscribe?u=8c606905a7e637766f218816b&id=2e47bac84d&e=407e758886&c=e27229afde>, <mailto:unsubscribe-mc.us19_8c606905a7e637766f218816b.e27229afde-407e758886@mailin.mcsv.net?subject=unsubscribe>List - Unsubscribe - Post: List - Unsubscribe = One - Click

Do you see anything wrong with that?

First, each URL should be enclosed in <>'s. Your first URL is missing the leading < character.

Secondly, you are including the List-Unsubscribe-Post header in the value of the List-Unsubscribe header. They need to be 2 distinct headers.

In other words, the receiving client is probably getting confused as to what the value is supposed to be because it is completely borked.

Upvotes: 1

Related Questions