0

PHP/Zend アプリケーションから PDF が添付された破損した電子メールを受信して​​います。最近、MS Office365 に移行しました。MS は、MIME 形式が Office365 でサポートされていないと言っています。

添付ファイルがある場合にのみ、電子メールが破損します。デフォルトでは、MIME 形式の Zend フォーム メール。私たちの選択肢は何ですか?PHP/Zend アプリケーションから office365 を介して PDF 添付ファイル付きの電子メールを送信するにはどうすればよいですか?

編集1

メールを送信する PHP コード:

$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 your FWS Orientation!');

$file = Zend_Registry::get('config')->app->pdf_path."CertificateAndAgreement.pdf";
//load pdf from 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 from string
$contents = file_get_contents($file);
$at2 = $mail->createAttachment($contents);   
$at2->filename = "Handouts.pdf";
$at2->type        = 'application/pdf';
$mail->send();

そして、これは私たちが受け取っている電子メールの例です:

    This is a message in Mime Format.  If you see this, your mail reader does not support this format.

--_c0af0986a1041f0bc7afd728e445b8db
Content-Type: text/plain; charsetiso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Congratulations on completing your 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 a lot of garbage instead of PDF file]

これがこのメッセージのヘッダーです

    Received: from BY2PRD0712HT001.namprd07.prod.outlook.com (10.255.246.34) by
 BL2PRD0711HT005.namprd07.prod.outlook.com (10.255.104.168) with Microsoft
 SMTP Server (TLS) id 14.16.329.3; Thu, 11 Jul 2013 17:58:15 +0000
Received: from BY2PRD0712HT003.namprd07.prod.outlook.com (10.255.246.36) by
 BY2PRD0712HT001.namprd07.prod.outlook.com (10.255.246.34) with Microsoft SMTP
 Server (TLS) id 14.16.329.3; Thu, 11 Jul 2013 17:58:14 +0000
Received: from mail39-co1-R.bigfish.com (216.32.180.180) by
 BY2PRD0712HT003.namprd07.prod.outlook.com (10.255.246.36) with Microsoft SMTP
 Server (TLS) id 14.16.329.3; Thu, 11 Jul 2013 17:58:08 +0000
Received: from mail39-co1 (localhost [127.0.0.1])   by mail39-co1-R.bigfish.com
 (Postfix) with ESMTP id 1E9AF1000A2    for <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 as permitted sender) client-ip=128.125.137.218; envelope-from=someuser@usc.edu; helo=msg-ironport3.usc.edu ;ort3.usc.edu ;
Received: from mail39-co1 (localhost.localdomain [127.0.0.1]) by mail39-co1
 (MessageSwitch) id 1373565485428745_21893; Thu, 11 Jul 2013 17:58:05 +0000
 (UTC)
Received: from CO1EHSMHS001.bigfish.com (unknown [10.243.78.249])   by
 mail39-co1.bigfish.com (Postfix) with ESMTP id 25BEBE0062  for
 <username@exchange.usc.edu>; Thu, 11 Jul 2013 17:58:05 +0000 (UTC)
Received: from msg-ironport3.usc.edu (128.125.137.218) by
 CO1EHSMHS001.bigfish.com (10.243.66.11) with 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: from email-staff.usc.edu ([128.125.137.21])  by msg-ip3.usc.edu with
 ESMTP; 11 Jul 2013 10:55:50 -0700
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain
Received: from msg-ironport2.usc.edu (msg-ironport2.usc.edu [128.125.137.216])
 by email-staff.usc.edu (Sun Java(tm) System Messaging Server 7u3-17.01 64bit
 (built Jun  8 2010)) with ESMTP id <0MPS00KPP9SN3A70@email-staff.usc.edu> for
 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: from sowksec1.usc.edu (HELO SOWKSEC1) ([68.181.121.7]) by
 msg-ironport2.usc.edu with 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
4

1 に答える 1