POP3 - Mail Headers - Attachments...

andrew at bishop.dropbear.id.au andrew at bishop.dropbear.id.au
Sat Nov 10 16:13:12 EST 2001


On Sat, 10 Nov 2001, Donovan J. Edye wrote:

> I am looking for a lightweight way using POP3 to determine:

Ok, first up, POP doesn't understand MIME.  It just lets you get the
messages.  You can use the top command to get only the headers, or the
headers and some of the message, but that's all pop will do for you.

> -          If a message has an attachment

Can be done with a reasonable degree of accuracy.  Just get the headers
(pop command: top <message no> 0), check for a content-type of
multipart/mixed.  Of course, it's *possible* to have a multipart/mixed
message with only one part...  or a multipart/alternative where one of the
alternatives has attachments... or any number of bizarre other
possibilities that you probably won't encounter in normal use.

> -          What the name of the attachment is

This info isn't in the headers.  You'd have to get enough of the message
to see the start of the attachment.

> -          What size the attachment is

As above (but you can make a guess from the total size of the message).

> I have read the RFC’s and cannot readily see a way to do this. I don’t want
> to download the message to get this info. I just want to determine it from
> the mail headers if possible. Any ideas or pointers?

POP just wasn't designed to do what you want it to do.  Give up now. :-)

Andrew





More information about the linux mailing list