MIME“发件人:”带有国家字符的标题

发布于 2024-09-24 11:50:43 字数 809 浏览 10 评论 0原文

当发件人名称包含国家字符和点 (.) 字符时,“发件人:”标题的正确格式是什么?

我们生成(使用 C# Chilkat lib):(

From: =?utf-8?Q?Micha=C5=82_from_domain.com?= <[email protected]>

其中 From Name = 来自domain.com 的 Michał)

这在大多数情况下都可以正常工作。但是,我们遇到了一个电子邮件提供商,该提供商将此标头标记为无效并使用 Return-Path 标头(仅机器可读)。

错误是:

Illegal-Object: Syntax error in From: address found on ps11.m5r2.onet: 
From: =?utf-8?Q?Micha=C5=82_from_domain.com?=<[email protected]>
^-missing end of mailbox

提供商坚持认为问题是姓名和电子邮件之间缺少空格。我们的情况并非如此(请参阅前面的代码示例)。

What is the correct format of "From:" header when From Name contains national characters and dot (.) character?

We generate (using C# Chilkat lib) this:

From: =?utf-8?Q?Micha=C5=82_from_domain.com?= <[email protected]>

(where From Name = Michał from domain.com)

This works OK in most cases. However, we encountered an email provider which marks this header as invalid and uses Return-Path header instead (which is machine-readable only).

The error is:

Illegal-Object: Syntax error in From: address found on ps11.m5r2.onet: 
From: =?utf-8?Q?Micha=C5=82_from_domain.com?=<[email protected]>
^-missing end of mailbox

The provider insists the the problem is the lack of space between name and email. This is not the case on our end (see previous code example).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

探春 2024-10-01 11:50:43

该电子邮件提供商的 MTA 已损坏。不幸的是,你必须处理它。

您已经将非 ASCII“发件人”个人部分格式化为 RFC 2047 编码字。由于您使用 Q 作为编码,因此您可以利用引用打印编码的灵活性并对 . 进行编码:(

From: =?utf-8?Q?Micha=C5=82_from_domain=2Ecom?= <[email protected]>

请注意,>. 已被其引用的可打印编码 =2E 取代。)

That email provider has a broken MTA. Unfortunately, you have to deal with it.

You're already formatting your non-ASCII "From" personal-part as an RFC 2047 encoded-word. Since you're using Q as the encoding, you can take advantage of the flexibility in the quoted-printable encoding and encode the . as well:

From: =?utf-8?Q?Micha=C5=82_from_domain=2Ecom?= <[email protected]>

(Note that the . has been replaced by its quoted-printable encoding, =2E.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文