Hey folks,

I'm in need of a class/function/script that can decode an email (I have a script on the mail server that pushes the stdin as $stdin to a php page on another server). So what I have is the full email as one big var (which I can split on \r\n normally), it's the same message.

Ok, now that I dispensed with the "I'm not a newbie" intro, I was wondering if anyone knows of a script that can take this message and decode it, I'm stuck at trying to parse it if it's mime/multipart since I'm not familiar with the RFC and don't have time to become a mime expert today 🙂

TIA for any help,
Stephen VanDyke

    Most of the mail message (being text) should be easy to parse. If there are attachments, they will be base64 encoded. Just take the lines between the start and stop strings

    1) trim() them
    2) use base64_decode() on them
    3) concatenate the results into one long binary string
    4) save to a file with the file name and extension in the header.

    see:
    http://www.phpbuilder.com/manual/function.base64-decode.php

    -- Rich

      Write a Reply...