Recommend this page to a friend! |
PHP MIME Email Message Parser | > | All threads | > | application/pkcs7-mime... | > | (Un) Subscribe thread alerts |
|
![]() Hello,
is there a solution for application/pkcs7-mime; smime-type=signed-data mails? In Outlook it's a "normal" HTML-Mail with 2 attachments (a PDF and VCF) and a Lock-Icon. Need the normal HTML/Body-Part and the attachments. In mime_parser.php only x-pkcs7-signature and pkcs7-signature. But it's 'signed-data' and not a 'signature', so decryption is needed? I don't know :-( Cannot forward the message to Manuel because it's contain confidential information. Thank you -- Message structure array(8) { ["Headers"]=> array(22) { ["received:"]=> array(8) { ... } ["from:"]=> string(56) ""..." " ["to:"]=> string(26) ""..." " ["references:"]=> string(51) "..." ["in-reply-to:"]=> string(51) "..." ["subject:"]=> string(31) "..." ["date:"]=> string(31) "..." ["message-id:"]=> string(63) "..." ["mime-version:"]=> string(3) "1.0" ["content-type:"]=> string(64) "application/pkcs7-mime; smime-type=signed-data; name="smime.p7m"" ["content-transfer-encoding:"]=> string(6) "base64" ["content-disposition:"]=> string(32) "attachment; filename="smime.p7m"" ["x-mailer:"]=> string(22) "Microsoft Outlook 15.0" ["content-language:"]=> string(2) "de" ["thread-index:"]=> string(36) "...." ["x-ms-exchange-organization-authsource:"]=> string(16) "...." ["x-ms-has-attach:"]=> string(3) "yes" ["x-ms-tnef-correlator:"]=> string(0) "" ["x-originating-ip:"]=> string(14) "..." ["x-virus-scanned:"]=> string(57) "...." ["x-ctch-refid:"]=> string(84) "...." ["x-olkeid:"]=> string(172) "..." } ["Parts"]=> array(0) { } ["Position"]=> int(0) ["FileName"]=> string(9) "smime.p7m" ["FileDisposition"]=> string(10) "attachment" ["BodyPart"]=> int(1) ["BodyLength"]=> int(99733) ["ExtractedAddresses"]=> array(2) { ["from:"]=> array(1) { [0]=> array(2) { ["address"]=> string(28) "..." ["name"]=> string(23) "..." } } ["to:"]=> array(1) { [0]=> array(2) { ["address"]=> string(14) "..." ["name"]=> string(7) "..." } } } } Message analysis array(8) { ["Type"]=> string(297) "application/pkcs7-mime message parts are not yet recognized. You can define these part type names and descriptions setting the custom_mime_types class variable. Please contact the author Manuel Lemos and send a copy of this message to let him add support for this kind of messages"
![]() Do you want to decrypt any encrypted data, or just parse parts that may be signed?
![]() Hello Manuel,
the header is not encrypted, I can read [From:"], ["to:"], ["subject:"], ["date:"] ... I need the HTML/text-part and the attachments. It's all in the smime.p7m-file. About "smime-type": enveloped-data means encrypted mail signed-data means mail is only signed certs-only menas only certificate So the mail is not encrypted. You can check up the signature, but it's not necessary, right? A sub-function to parse the content from smime.p7m as the "real" mail-body-content is necessary. Best regards Olli
![]() Oh, did you try adding an entry to the custom_mime_types variable?
Take a look at the test_message_decoder.php example script.
![]() Yes, I try, but without success. I'm not 100% sure in this special field of mail/smime and so :-\
I need to save the parts (MailText/HTML-Content, attachment) to HDD with the SaveBody-parameter. I try with input the hole mail and also the smime.p7m with the test_message_decoder.php MIME message decoding successful. 1 message was found. Message 1: array(6) { ["Headers"]=> array(0) { } ["Parts"]=> array(0) { } ["Position"]=> int(0) ["BodyFile"]=> string(7) "tmp\1" ["BodyPart"]=> int(1) ["BodyLength"]=> int(99734) } array(3) { ["Type"]=> string(4) "text" ["Description"]=> string(12) "Text message" ["DataFile"]=> string(7) "tmp\1" } Warning: message headers do not end with empty line at position 0 line 1 column 1 -- Here is the content from smime.p7m: 0 *Hχ 010 + 0 *Hχ $Content-Type: multipart/mixed; boundary="----=_NextPart_000_0005_01D223E0.4DB46480" This is a multipart message in MIME format. ------=_NextPart_000_0005_01D223E0.4DB46480 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Hello (...) ------=_NextPart_000_0005_01D223E0.4DB46480 Content-Type: application/octet-stream; name="xxx.pdf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xxx.pdf" JVBE (....) eHJlZg0KNjY1ODYNCiUlRU9G ------=_NextPart_000_0005_01D223E0.4DB46480 Content-Type: text/x-vcard; name="vCard.vcf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vCard.vcf" BEGIN:VCARD VERSION:2.1 (...) END:VCARD ------=_NextPart_000_0005_01D223E0.4DB46480-- 0 (...) χπτΎ£l|)uΚ}ου7D --------------------------------------------------- In the first lines some stuff, don't know what information this is. Then the Text-Body of the mail which i need. Next two parts: the PDF and vcf as attachment which i need. Last part: i think this is the signature-data to verify the content. I don't need to verify, but maybe, it would be nice when your class can do that also, but not necessary yet.
![]() First the warning there, means that you are joining the headers and the body of the message without the additional empty line. This may affect the parsing of the initial message part.
Then you should call the Analyze function like in the example script, adding that entry to custom_mime_types so it accepts that type of message part. You are saving message parts to files, so you may need to read back those files to strings to do something useful, or just disable the SaveBody parameter. That should return an easier to process summary of the message structure. |
info at phpclasses dot org
.