Page 1 of 1

RFC822/.eml attachments

Posted: Thu Mar 27, 2008 6:50 am
by mchaggis
Hi,

I'm trying to write a script that can read an RFC882 formatted file. Be it as an attachment as part of another email or a static file and was wondering if anyone has had any experience or can point me in the right direction?

Cheers

Re: RFC822/.eml attachments

Posted: Thu Mar 27, 2008 9:23 pm
by Chris Corbyn
mchaggis wrote:Hi,

I'm trying to write a script that can read an RFC882 formatted file. Be it as an attachment as part of another email or a static file and was wondering if anyone has had any experience or can point me in the right direction?

Cheers
Have you read RFC 2822, 2045 and 2046? They'll give you a lot of help if you try to convert the ABNF into regex. What specifically do you need to parse out? The possibilities are endless if you want to parse anything and everything.

EDIT | I should mention I'm releasing a library soon which will parse RFC 2822 compliant messages into Swift message objects.

Re: RFC822/.eml attachments

Posted: Fri Mar 28, 2008 2:59 am
by mchaggis
I would like to parse them in the same way I would a normal email message. Basically, I want to be able to extract attachments contained with in and also display the text/html portions of the message.

Once I can do that, I can do everything I will need to do with the content of the message.

I have seen some people suggest that extract the RFC822 attachment and then using the PHP imap functions append it to a mailbox and then read it as if it was a normal message. However, this does not solve the processing of a file and it throws extract complications in that I would have to choose a folder to put it in, or generate a temp folder, but this may cause additional issues.

Cheers