473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

imaplib & Received: header(s)???

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
2 2293
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Max M | last post by:
I am using the fetch command from the imaplib to fetch messages. I get a result, but I am a bit uncertain as to how I should interpret it. The result is described at...
4
by: Raghul | last post by:
Hi Friends, I am doing project in python.I am new to this. My problem is I want to move the mail message to other folder in the mail using imaplib (E.g) I want to move a message from the inbox...
1
by: Raghul | last post by:
Is it posssible to read only the new messages or unread messages using imaplib in python? If it is possible pls specify the module or give a sample code. Thanks in advance
0
by: Wolfgang Kohnen | last post by:
Hello out there! I am new to python and so far I like it a lot. Now I want to create some IMAP mailboxes on my cyrus imapd, with quotas and each user should be subscribed to her/his own spam...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.