TripleDES Posted July 10, 2007 Share Posted July 10, 2007 What's the best way to extract email attachments that's encoded in base64? I can run the base64 encoded stuff through base64_decod(), but I want to know if there is a function to handle attachments. Example: ------_=_NextPart_001_01C7C330.9D7B678C Content-Type: text/plain; name=report.csv Content-Transfer-Encoding: base64 Content-Description: report_=.csv Content-Disposition: inline; filename=report.csv Quote Link to comment Share on other sites More sharing options...
TripleDES Posted July 11, 2007 Author Share Posted July 11, 2007 Anyone? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 11, 2007 Share Posted July 11, 2007 I do not think there is a function to handle this type of stuff. You may try the base64 decode with www.php.net/readfile to display it/download it. www.php.net/headers for more examples on the readfile/download. Quote Link to comment Share on other sites More sharing options...
TripleDES Posted July 11, 2007 Author Share Posted July 11, 2007 Thanks. I did find several mail parsing functions through pecl, but several of them are undocumented. mailparse_determine_best_xfer_encoding — Gets the best way of encoding mailparse_msg_create — Create a mime mail resource mailparse_msg_extract_part_file — Extracts/decodes a message section mailparse_msg_extract_part — Extracts/decodes a message section mailparse_msg_extract_whole_part_file — Extracts a message section including headers without decoding the transfer encoding mailparse_msg_free — Frees a MIME resource mailparse_msg_get_part_data — Returns an associative array of info about the message mailparse_msg_get_part — Returns a handle on a given section in a mimemessage mailparse_msg_get_structure — Returns an array of mime section names in the supplied message mailparse_msg_parse_file — Parses a file mailparse_msg_parse — Incrementally parse data into buffer mailparse_rfc822_parse_addresses — Parse RFC 822 compliant addresses mailparse_stream_encode — Streams data from source file pointer, apply encoding and write to destfp mailparse_uudecode_all — Scans the data from fp and extract each embedded uuencoded file Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.