Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Location
    Pittsburgh PA
    Posts
    289

    Parse .eml file with PHP?

    Hey there,

    We have a customer that needs to send out a newsletter to its customers who opted in to their mailing list.

    So anyways, they were sending it from Outlook before, and basically Yahoo! was rejecting the mail because they were sending it too quickly or something like that.

    So I said I would develop some software that basically would mail to their list but it would fork a process, and sleep for 15 seconds or so between messages, which is not difficult to do.

    So they sent me a demo email and I decided that it would be best to just have them upload the .eml file and this program would parse the .EML file and send it sleeping 15 seconds or so between each message.

    I unfortunately cannot find any good reading on how to parse an .EML file and send it out.

    Any thoughts? (This is not for SPAM purposes, it is a legitimate opt-in opt-out list)

  2. #2
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100
    You need something that will mime decode the file.

    I used this class in project 5 years ago and things work out well iirc,
    http://phpclasses.cfappsinc.ca/browse/package/347.html

  3. #3
    Join Date
    Feb 2006
    Location
    Pittsburgh PA
    Posts
    289
    Thanks!

    I actually tried using that class... did you ever use this for a .EML file? it actually looks really really nasty, invalid characters out the wazoo... maybe I should send it and see what it looks like... to test addresses of course lol

  4. #4
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100
    I was not parsing .eml file, I was parsing actual email.

    This is how it went:
    1. I would create HTML email template and opened that template in Outlook Express and then saved it as .eml file.
    2. Every time client would want to send email to his list he would simply open that .eml file in outlook, add content and make changes he needs and then he would send it to predetermined email address
    3. Mail server was setup to intercept emails going to that predetermined address and it would redirect them to my script which would parse the message (using mime_decode class).
    4. The script would extract content end images from message. It would make folder and save images there and it would send email as HTML message with links to those images.

    This is something I did long time ago and if you contact me on IM i can give you a copy of the script. It is not up to par to my coding standard so I am not sure I want to post it in public.

  5. #5
    Join Date
    Aug 2001
    Location
    Orange County, CA
    Posts
    532
    You could use Mailparse too (http://us3.php.net/manual/en/ref.mailparse.php), but it requires a lot more black magic than the PEAR class mentioned above.

    Mailparse is fast (it's a C extension), memory-friendly (it's not constrained by php.ini's memory_limit) and notorious for being very badly documented.

    But if you're dealing with a high volume of e-mail, it's worth looking into.
    Jeff Standen, Chief of R&D, WebGroup Media LLC. - LinkedIn
    Cerb is a fast and flexible web-based platform for business collaboration and automation. http://www.cerbweb.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •