これはすべて、質問でリンクしたrfcで定義されています(ところで、このドキュメントの新しいバージョンはRFC 5322です):
display-name = phrase
phrase = 1*word / obs-phrase
word = atom / quoted-string
atom = [CFWS] 1*atext [CFWS]
atext = ALPHA / DIGIT / ; Any character except controls,
"!" / "#" / ; SP, and specials.
"$" / "%" / ; Used for atoms
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"
specials = "(" / ")" / ; Special characters used in
"<" / ">" / ; other parts of the syntax
"[" / "]" /
":" / ";" /
"@" / "\" /
"," / "." /
DQUOTE
これらの各トークン タイプの定義を見つけるには、ドキュメント内を少し移動する必要がありますが、それらはすべてそこにあります。
定義を取得したら、名前文字列をスキャンして、有効な文字のみで構成されているかどうかを確認するだけです。
定義によると、adisplay-name
は aphrase
であり、aphrase
は 1 つ以上のword
トークンです (または、obs-word
この説明を簡単にするために、ここでは無視します)。
word
トークンはatom
または のいずれかquoted-string
です。
あなたの例では、トークン内に表示できない文字John Q. Public
が含まれています。トークンはどうですか?さて、見てみましょう...special
"."
atom
quoted-string
quoted-string = [CFWS]
DQUOTE *([FWS] qcontent) [FWS] DQUOTE
[CFWS]
qcontent = qtext / quoted-pair
qtext = NO-WS-CTL / ; Non white space controls
%d33 / ; The rest of the US-ASCII
%d35-91 / ; characters not including "\"
%d93-126 ; or the quote character
これに基づいて、 a"."
は引用符で囲まれた文字列内で許可されていることがわかります。そのため、... your の正しいフォーマットdisplay-name
は次のいずれかになります。
From: "John Q. Public" <JQB@bar.com>
また
From: John "Q." Public <JQB@bar.com>
また
From: "John Q." Public <JQB@bar.com>
また
From: John "Q. Public" <JQB@bar.com>
それらのいずれかが機能します。