Wondering if there's a way I can avoid fetching the attachments as well.
views:
16answers:
3
+1
Q:
Does imap.fetch(uid,'RFC822')[0].attr['RFC822'] return the entire message, including attachments?
A:
Yes, it returns the entire email source. The attachments are encoded as email parts.
You can use the Ruby Mail library to extracts all the attachments.
Simone Carletti
2010-10-21 10:06:43
A:
I don't know about ruby , but it can be done only fetching Email Header.
I am Fetching Email header in Python like below:
resp, data = obj.uid('FETCH' , ','.join(map(str,uid_lst)),'(RFC822.HEADER RFC822.SIZE)')
where uid_lst is the list of uids of emails which you want to fetch.
Note: Email which has value of header field Content-Type = 'Multipart-Mixed' has an attachment.
Avadhesh
2010-10-21 12:04:23
A:
Hi,
If all you want to do, is download the email body(ies), there isn't a clean way of doing this (at least none that I disovered).
What I had to do, was first download the headers and the body structures. Once I had the headers, I could determine what type of email it was (multi-part, alternative, or just a single bodied email).
Once I knew the structure, I could download the plain text or html body part as a body section.
Does that help?
--Dave
dave wanta
2010-10-21 12:27:13