php - Mime and Office365 -
we receiving corrupted emails pdf attachments our php/zend application. migrated ms office365. ms telling mime format not supported office365.
the emails corrupted when have attachments. zend form emails in mime format default. our options? how can send emails pdf attachments, php/zend application through office365?
edit 1
php code sends email:
$mail = new zend_mail(); $mail->setfrom(zend_registry::get('config')->app->contact->email); $mail->addto($this->getuscemail(), $this->getfirstname().' '.$this->getlastname()); $mail->addcc(zend_registry::get('config')->app->contact->email, 'sowk fws'); $mail->setsubject('workstudy documentation - '.$this->getfirstname().' '.$this->getlastname()); $mail->setbodytext('hi '.$this->getfirstname().",\r\n".'congratulations on completing fws orientation!'); $file = zend_registry::get('config')->app->pdf_path."certificateandagreement.pdf"; //load pdf string $pdf = zend_pdf::load($file); $font = zend_pdf_font::fontwithname(zend_pdf_font::font_helvetica); $page = $pdf->pages[0]; $page->setfont($font, 12); $page->drawtext($this->getfirstname().' '.$this->getlastname(), 72, 133); $uscid = $this->getuscid(); $page->drawtext(substr($uscid, 0, 4).'-'.substr($uscid, 4, 2).'-'.substr($uscid, -4), 340, 133); $at = $mail->createattachment($pdf->render()); $at->filename = "certificateandagreement.pdf"; $at->type = 'application/pdf'; $file = zend_registry::get('config')->app->pdf_path."fwsorientationhandouts.pdf"; //load pdf string $contents = file_get_contents($file); $at2 = $mail->createattachment($contents); $at2->filename = "handouts.pdf"; $at2->type = 'application/pdf'; $mail->send();
and example of email getting:
message in mime format. if see this, mail reader not support format. --_c0af0986a1041f0bc7afd728e445b8db content-type: text/plain; charsetiso-8859-1 content-transfer-encoding: quoted-printable content-disposition: inline congratulations on completing fws orientation! --_c0af0986a1041f0bc7afd728e445b8db content-type: application/pdf content-transfer-encoding: base64 content-disposition: attachment; filename"certificateandagreement.pdf" jvberi0xljunciw1tbw1dqoxidagb2jqdqo8pc9uexbll0nhdgfsb2cvugfnzxmgmiawifiv tgfuzyhlbi1vuykgl1n0cnvjdfryzwvsb290idixidagui9nyxjrsw5mbzw8l01hcmtlzcb0 cnvlpj4+pg0kzw5kb2jqdqoyidagb2jqdqo8pc9uexbll1bhz2vzl0nvdw50idevs2lkc1sg myawifjdid4+dqplbmrvymoncjmgmcbvymoncjw8l1r5cguvugfnzs9qyxjlbnqgmiawifiv umvzb3vyy2vzpdwvrm9uddw8l0yxidugmcbsl0yyidcgmcbsl0yzidkgmcbsl0y0ide0idag ui9gnsaxniawifivrjygmtggmcbspj4vuhjvy1nldfsvuergl1rlehqvsw1hz2vcl0ltywdl qy9jbwfnzuldid4+l01lzglhqm94wyawidagnjeyidc5ml0gl0nvbnrlbnrzidqgmcbsl0dy b3vwpdwvvhlwzs9hcm91cc9tl1ryyw5zcgfyzw5jes9duy9ezxzpy2vsr0i+pi9uywjzl1mv u3rydwn0ugfyzw50cyawpj4ncmvuzg9iag0kncawig9iag0kpdwvrmlsdgvyl0zsyxrlrgvj b2rll0xlbmd0acaxmji1nt4+dqpzdhjlyw0ncnicvz1zkxzhkeffacbvka/zgf4ju3kfszkz rxhinkwoeacryas1tqk6ioyk6iia3yk4n378iopvlvnv5vk7kxkbvhd4+i8oj/cicm8qfvb7 ... [here comes lot of garbage instead of pdf file]
here header of message
received: by2prd0712ht001.namprd07.prod.outlook.com (10.255.246.34) bl2prd0711ht005.namprd07.prod.outlook.com (10.255.104.168) microsoft smtp server (tls) id 14.16.329.3; thu, 11 jul 2013 17:58:15 +0000 received: by2prd0712ht003.namprd07.prod.outlook.com (10.255.246.36) by2prd0712ht001.namprd07.prod.outlook.com (10.255.246.34) microsoft smtp server (tls) id 14.16.329.3; thu, 11 jul 2013 17:58:14 +0000 received: mail39-co1-r.bigfish.com (216.32.180.180) by2prd0712ht003.namprd07.prod.outlook.com (10.255.246.36) microsoft smtp server (tls) id 14.16.329.3; thu, 11 jul 2013 17:58:08 +0000 received: mail39-co1 (localhost [127.0.0.1]) mail39-co1-r.bigfish.com (postfix) esmtp id 1e9af1000a2 <username@exchange.usc.edu>; thu, 11 jul 2013 17:58:08 +0000 (utc) x-forefront-antispam-report: cip:128.125.137.218;kip:(null);uip:(null);ipv:nli;h:msg-ironport3.usc.edu;rd:msg-ironport3.usc.edu;efvd:nli x-spamscore: 0 x-bigfish: ps0(zzzz1f42h1d77h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzzz2fh2a8h668h839hd24h1288h12a5h12a9h12bdh12e5h137ah13b6h13eah1441h14ddh1504h1537h153bh162dh1631h1758h18b6h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh35h1155h) received-spf: pass (mail39-co1: domain of usc.edu designates 128.125.137.218 permitted sender) client-ip=128.125.137.218; envelope-from=someuser@usc.edu; helo=msg-ironport3.usc.edu ;ort3.usc.edu ; received: mail39-co1 (localhost.localdomain [127.0.0.1]) mail39-co1 (messageswitch) id 1373565485428745_21893; thu, 11 jul 2013 17:58:05 +0000 (utc) received: co1ehsmhs001.bigfish.com (unknown [10.243.78.249]) mail39-co1.bigfish.com (postfix) esmtp id 25bebe0062 <username@exchange.usc.edu>; thu, 11 jul 2013 17:58:05 +0000 (utc) received: msg-ironport3.usc.edu (128.125.137.218) co1ehsmhs001.bigfish.com (10.243.66.11) microsoft smtp server (tls) id 14.1.225.23; thu, 11 jul 2013 17:57:55 +0000 x-ironport-av: e=sophos;i="4.89,1045,1367996400"; d="scan'208";a="240502123" received: email-staff.usc.edu ([128.125.137.21]) msg-ip3.usc.edu esmtp; 11 jul 2013 10:55:50 -0700 mime-version: 1.0 content-disposition: inline content-type: text/plain received: msg-ironport2.usc.edu (msg-ironport2.usc.edu [128.125.137.216]) email-staff.usc.edu (sun java(tm) system messaging server 7u3-17.01 64bit (built jun 8 2010)) esmtp id <0mps00kpp9sn3a70@email-staff.usc.edu> username@exchange.usc.edu (orcpt username@usc.edu); thu, 11 jul 2013 10:55:47 -0700 (pdt) authentication-results: msg-ironport2.usc.edu; dkim=neutral (message not signed) header.i=none message-id: <45927a$14o9gj0@msg-ironport2.usc.edu> x-ironport-av: e=sophos;i="4.89,1045,1367996400"; d="pdf'?scan'208";a="1233437287" received: sowksec1.usc.edu (helo sowksec1) ([68.181.121.7]) msg-ironport2.usc.edu smtp; thu, 11 jul 2013 10:55:39 -0700 subject: workstudy documentation - viktor raskin to: <username@usc.edu> from: <username@usc.edu> cc: sowk fws <username@usc.edu> date: thu, 11 jul 2013 10:55:39 -0700 return-path: someuser@usc.edu x-ms-exchange-organization-scl: -1 x-ms-exchange-organization-avstamp-mailbox: msftff;1;0;0 0 0 x-ms-exchange-inbox-rules-loop: username@usc.edu x-ms-exchange-organization-authsource: by2prd0712ht003.namprd07.prod.outlook.com x-ms-exchange-organization-authas: anonymous
well, solution add html content body of email. not sure why office365 requirring both
$mail->setbodytext(strip_tags($content)); $mail->setbodyhtml($content);
it can changed on server side. ms support not aware fact.
Comments
Post a Comment