views:

200

answers:

1

I understand there are php IMAP functions to extract certain elements from an email stored in a mailbox. What I am trying to discover is whether this can translate to emails piped to a script.

The scripts that I have looked at for extracting the body and attachments are fairly inflexible and bulky. I sent my pipe script a variety of different email formats and it saved them in vastly different ways which makes me wary of starting to write a script myself.

Also as some of the emails sent from my work address attach a signature. Does anyone have any ideas how to combat this. I have a bunch of rather daft people who won't even understand the term 'don't add a signature when sending this email', or 'send in plain text only'.

A: 

AFAIK, the format for storing messages is not defined by any RFC however deliver, procmail and .forward all rely on the the headers being seperated from the body by a blank line.

symcbean
Cheers. I am actually looking at exploding the content around a commonly uniform character. If we're looking at line breaks, how would one differentiate between paragraphs.
kalpaitch
I didn't mean to imply that there won't be blank lines **before** the header, nor that there won't be blank lines **within** the body - only that there are no blank lines within the header, and at least one between headers and body.
symcbean
I've successfully piped my emails to a script. Have you gotten anywhere on extracting attachments?
st4ck0v3rfl0w
I am going to assume the data you want out of attachments is images. In my case that is the only useful part of an attahcment that I might want to keep. I am planning on exploding the contents of the email and extracting the encoded image part - then use the php base64_decode() function. I will let you know more when I think about it again. It is not on my list of priorities right now.
kalpaitch