RFC822/.eml attachments

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

RFC822/.eml attachments

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: RFC822/.eml attachments

Post 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.
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Re: RFC822/.eml attachments

Post 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
Post Reply