By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

imaplib & Received: header(s)???

P: n/a
Hello,

Is there a way to get at the "Received" header(s) or is there something
in imaplib or imap server implementations that hides these? If not, what
IMAP FETCH command should be used? I've used for example
"BODY[HEADER.FIELDS (RECEIVED)]" and it always returns empty ("\r\n").
Despite the Received - header existing, as demonstrated by taking a look
at message sources via desktop email clients.

I need to get at the Received-for header to figure out at which address
we received an email. We subscribe to a number of mailing lists using
per-mailing-list addresses, and often, To: field contains something else
than our address, thus the need for Received-for.

Any help would be much appreciated - this is baffling me and I've not
found anything recent that would help.

Thanks,

Petri

Aug 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Quoth Petri Savolainen <pe**************@iki.fi>:

| Is there a way to get at the "Received" header(s) or is there something
| in imaplib or imap server implementations that hides these? If not, what
| IMAP FETCH command should be used? I've used for example
| "BODY[HEADER.FIELDS (RECEIVED)]" and it always returns empty ("\r\n").
| Despite the Received - header existing, as demonstrated by taking a look
| at message sources via desktop email clients.
|
| I need to get at the Received-for header to figure out at which address
| we received an email. We subscribe to a number of mailing lists using
| per-mailing-list addresses, and often, To: field contains something else
| than our address, thus the need for Received-for.
|
| Any help would be much appreciated - this is baffling me and I've not
| found anything recent that would help.

"Anything recent"? If you're getting IMAP advice from comp.lang.python,
I think it's fair to say you will need to be more resourceful. The
RFC for IMAP4rev1 should be helpful. I don't know the IMAP to get a
single header field, but my guess is that your error is there. Can you
retrieve other fields that way? Does the one you're looking for appear
in the data if you get the whole header, for example with 'RFC822.HEADER'?
It certainly does in my Python IMAP client, and this would have at least
helped you refine your question.

Donn Cave
Aug 19 '07 #2

P: n/a
Donn Cave wrote:
| I need to get at the Received-for header to figure out at which address
| we received an email. We subscribe to a number of mailing lists using
| per-mailing-list addresses, and often, To: field contains something else
| than our address, thus the need for Received-for.
|

"Anything recent"? If you're getting IMAP advice from comp.lang.python,
I think it's fair to say you will need to be more resourceful. The
RFC for IMAP4rev1 should be helpful. I don't know the IMAP to get a
single header field, but my guess is that your error is there. Can you
retrieve other fields that way? Does the one you're looking for appear
in the data if you get the whole header, for example with 'RFC822.HEADER'?
It certainly does in my Python IMAP client, and this would have at least
helped you refine your question.
Thanks Donn,

I had already checked everything relevant, including what you suggested.
The only examples that I found including the Received header utilized
the now-obsoleted rfc822 library in python from many years and versions
back. Thus nothing recent.

However, you mentioning "RFC822.HEADER" working for you prompted me to
try another mail server... to my surprise, everything worked. It appears
some imap servers do not allow programmatic fetching of Received:
information. Should've done this check sooner :-(

Thanks,

Petri


Aug 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.