473,750 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2312
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.pytho n,
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.pytho n,
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.HEA DER" 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
3184
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 http://pydoc.org/2.3/imaplib.html as:: (typ, ) = <instance>.fetch(message_set, message_parts) In RFC 2060 it says: "The data items to be fetched can be either a single atom or a parenthesized list."
4
7181
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 to the Draft folder in my account using python code. Can any one help me by giving a sample code to do this? Thanks in advance
1
4934
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
1754
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 folder. This is what I've attempted: > >>> import imaplib, getpass > >>> cyrus = imaplib.IMAP4() > >>> cyrus.login("cyrus", getpass.getpass()) > Password:
0
9001
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9345
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9257
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8265
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6811
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4894
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.