My software is working with incoming e-mail from the one and only particular sender (let it be SantaClaus@hetnet.nl). According to RFC-2616 section 14 "From" header
MAY be used for logging purposes and as a means for identifying the source of invalid or unwanted requests.
That's exactly what I needed, so I wrote a code, which ignores all the messages where "From" field doesn't equal SantaClaus@hetnet.nl
. It worked good, but one day things changed, and now all the messages form Santa Claus contains a different string in "From" field (exactly <SantaClaus@hetnet.nl>
).
I already fixed my code, but I just wonder, is this header legal? Because the same RFC-2616 section 14 says:
The address SHOULD be machine-usable, as defined by "mailbox" in RFC 822 [9] as u开发者_开发问答pdated by RFC 1123 [8]:
From = "From" ":" mailbox
An example is:
From: webmaster@w3.org
Note the absense of angle brackets. But at the same time, many e-mail messages I receive on my Gmail account has something like this in the "From" field: "Santa Claus" <santaclaus@hetnet.nl>
RFC-822 allows email addresses to be specified either by a pure email-style address, called an "addr-spec" (e.g., name@host.domain
); or by using a nickname ("phrase") with the email-style address (the "addr-spec") enclosed in angle brackets (Foo Bar <foobar@host.domain>
). Your sender has gone from the first format to the second format, although here the nickname part seems to be empty.
By the way, RFC-2616 is for HTTP; you're looking at the definition of an optional, and (I imagine) rarely-used, From: header in the HTTP protocol. That doesn't seem to have any direct relevance on email formats.
精彩评论