“发件人:”中的有效字符显示电子邮件的名称

时间:2022-01-01 18:09:35

I am using PEAR Mail to send emails, and I found that if the "From:" field is something like From: Dragoş <email@example.com>, PEAR returns an error:

我正在使用PEAR Mail发送电子邮件,我发现如果“From:”字段类似From:Dragoş ,则PEAR会返回错误: @example.com>

Validation failed for: Dragoş <email@example.com>

验证失败:Dragoş @example.com>

But, if I remove the ş, PEAR returns true and sends email.

但是,如果我删除ş,PEAR返回true并发送电子邮件。

I tried to search on Google and * for valid characters, but seems I have no luck here. Does anyone know what are the valid characters for the display name in From field?

我试图在Google和*上搜索有效字符,但似乎我没有运气。有没有人知道From字段中显示名称的有效字符是什么?

Also, is there any way to "encode" these chars to be allowed on this field? I use PHP.

另外,有没有办法在这个字段上“编码”这些字符?我用PHP。

Thank you!
Nuno

谢谢!努诺

2 个解决方案

#1


3  

In MIME you have to use only ASCII encoded characters.

在MIME中,您只能使用ASCII编码字符。

In order to pass non-ASCII chars, you have to use Word encoding.

为了传递非ASCII字符,您必须使用Word编码。

Copied from the linked article:

从链接文章复制:

For example,

Subject: =?iso-8859-1?Q?=A1Hola,_se=F1or!?=

is interpreted as "Subject: ¡Hola, señor!".

被解释为“主题:¡Hola,señor!”。

The same can be applied to the "name" part (not the email) of the "From" and "To" MIME fields.

同样可以应用于“发件人”和“收件人”MIME字段的“名称”部分(不是电子邮件)。

#2


0  

When in doubt, consult the standard. What you're after is the display-name token, which is described on page 14.

如有疑问,请参阅标准。你所追求的是显示名称标记,如第14页所述。

#1


3  

In MIME you have to use only ASCII encoded characters.

在MIME中,您只能使用ASCII编码字符。

In order to pass non-ASCII chars, you have to use Word encoding.

为了传递非ASCII字符,您必须使用Word编码。

Copied from the linked article:

从链接文章复制:

For example,

Subject: =?iso-8859-1?Q?=A1Hola,_se=F1or!?=

is interpreted as "Subject: ¡Hola, señor!".

被解释为“主题:¡Hola,señor!”。

The same can be applied to the "name" part (not the email) of the "From" and "To" MIME fields.

同样可以应用于“发件人”和“收件人”MIME字段的“名称”部分(不是电子邮件)。

#2


0  

When in doubt, consult the standard. What you're after is the display-name token, which is described on page 14.

如有疑问,请参阅标准。你所追求的是显示名称标记,如第14页所述。