简体   繁体   English

Mailkit和Mimekit的标题编码问题

[英]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. 当我使用Mailkit发送电子邮件时,我注意到它会自动决定对内容和标头进行编码。 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****@****.*** 取消订阅列表:=?us-ascii?q?= 3Chttps = 3A = 2F = 2Fbarlinkar = 2Eus19 = 2Elist-manage = 2Ecom = 2Funsubscribe = 3Fu = 3D8c60690?==?us-ascii?q?5a7e637766f218816b&id = 3D2e47bac84 3De27229afde = 3E = 2C?==?us-ascii?q?_ == 3Cmailto = 3Aunsubscribe-mc = 2Eus19 = 5F8c606905aa7e637766f218816b = 2Ee27229a?==?us-ascii?q?fde-407e758886 = 40mailin = 2Emcsv = 2 3Dunsubscribe = 3E?= X-Report-Abuse:=?us-ascii?q?= 3Chttps = 3A = 2F = 2Fmailchimp = 2Ecom = 2Fcontact = 2Fabuse = 2F = 3Fu = 3D8c606905905a7e637766f218?= =?us-ascii?q?816b&id = 3De27229afde&e = 3D407e758886 = 3E?=收件人:k****@****.***

EDIT: Jstedfast pointed out some errors and I fixed them but the overall result is the same. 编辑:Jstedfast指出了一些错误,我修复了它们,但总体结果是相同的。

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. 首先,每个URL应该用<>括起来。 Your first URL is missing the leading < character. 您的第一个URL缺少前导<字符。

Secondly, you are including the List-Unsubscribe-Post header in the value of the List-Unsubscribe header. 其次,要包括的List-Unsubscribe-Post的头值的List-Unsubscribe头。 They need to be 2 distinct headers. 它们必须是2个不同的标头。

In other words, the receiving client is probably getting confused as to what the value is supposed to be because it is completely borked. 换句话说,接收方客户端可能会因为该值完全中断而对应该是什么感到困惑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM