我正在尝试发送带有 pdf 附件的 php 邮件程序电子邮件,并显示此错误:电子邮件未发送。错误:SMTP 错误:数据不被接受。SMTP 服务器错误:DATA END 命令失败详细信息:事务失败:缺少起始边界 SMTP 代码:554我试图在所有地方添加 mime 边界,但结果相同。<?phpinclude dirname(__FILE__) . '/../views/pdf-receipt.php';function sendMailTest( $recipient_mail, $recipient_name, $from_mail, $from_name, $subject, $body, $body_without_html, $attachments=NULL) { require 'folder/PHPMailer-5.2.26/PHPMailerAutoload.php'; $mail = new PHPMailer; try { $mail->isSMTP(); $mail->setFrom($from_mail, $from_name); $mail->addAddress($recipient_mail, $recipient_name); $mime_boundary = "Name of company".md5(time()); $mail->SMTPDebug = true; $mail->Host = 'email-smtp.eu-west-1.amazonaws.com'; $mail->Username = 'XXX'; $mail->Password = 'XXX'; $mail->Encoding = 'quoted-printable'; $mail->addCustomHeader('Content-ID', '20cca', 'Content-Type', 'multipart/mixed', 'boundary='.$mime_boundary.'\n'); $mail->Body = "--$mime_boundary\n"; $mail->CharSet = 'UTF-8'; $mail->Subject = utf8_encode($subject); $mail->Body .= "Hey\n"; $mail->AltBody .= "--$mime_boundary\n".$body_without_html; $mail->SMTPAuth = true; $mail->SMTPSecure = 'tls'; $mail->Port = 000; $mail->isHTML(true); $data = '%PDF-1.2 6 0 obj << /S /GoTo /D (chapter.1) >>'; // if i comment line below email is sent properly, // if i use AddAttachment local pdf file its working also, // but i use TCPD generated PDF and attaching it, if i will // just write it out to the message body i will see it as a // text or if i will attach 'addStringEmbeddedImage' its //displayed correctly but on same line as message text 我希望通过附件发送电子邮件,但看不到起始边界错误。
1 回答
- 1 回答
- 0 关注
- 398 浏览
添加回答
举报
0/150
提交
取消