Archived Forum Post

Index of archived forum posts

Question:

Email header questions

Sep 17 '12 at 10:53

What I want more information on is how your CkoEmail object handles certain headers:

1) Is GetHeader:(NSString*)headerName case sensitive? I.E., do I need to check for BOTH X-Priority and x-priority (as some email servers send it in both formats).

2) If the email message doesn't have a from header, but DOES have a return-path header, do you send the return-path data in the "getFromAddress" and "getFromName" method calls? I've seen more than one server that didn't send the From header, but DID send return-path.

3) For the "TO" field, do you support TO, x-apparently-to, and x-envelope-to, or do I have to check for those separately? I've seen several email server that didn't send TO, but DID send one of the other headers. How about the same question for CC and BCC? Do you cover the various cases internally, or do I need to query the separate possible header values on my own?

I can handle it either way… I just need to know the behavior of your library so I can account for the various options if you don't handle it internally.


Answer

1) Email headers are case-insensitive. For example, passing either "X-Priority" or "x-priority" to GetHeader will return the same header field regardless of the case used within the MIME. (The MIME standard is such that header field names are case-insensitive.)

2) The getFromAddress and getFromName methods return the information from the "From" header field. The GetHeaderField method can be used to get any header field by name, including "return-path".

3) Again, any header field can be retrieved by calling GetHeaderField.