在邮件中使用`addStringAttachment`和`addEmbeddedImage`到MS Outlook

时间:2018-04-19 15:11:40

标签: php email phpmailer email-attachments

我一直在尝试使用PHPMailer发送附件的电子邮件。这很好。然后我决定使用addEmbeddedImage - 方法嵌入图像。

现在我有问题了!电子邮件在Gmail中收到。但是当我在Windows中打开电子邮件时(使用MS-Outlook),附件消失!!

$mail = new PHPMailer;

//Server settings
$mail->SMTPDebug = 0;                       // Disable verbose debug output
$mail->isSMTP();                            // Set mailer to use SMTP
$mail->Host = $mailHost;                    // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                     // Enable SMTP authentication
$mail->Username = $mailUserName;            // SMTP username
$mail->Password = $mailPassword;            // SMTP password
$mail->SMTPSecure = 'tls';                  // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                          // TCP port to connect to

//Recipients
$mail->setFrom($mailSentFrom , $organisation);
$mail->addAddress($emailAdress, $recipientFullName);

//Attachments
$mail->addEmbeddedImage($_SERVER['DOCUMENT_ROOT'].PHP_PATH.'/library-overrides/FPDF/images/small-logo.jpg', 'logo');
$mail->addStringAttachment($attachment, "$categoryName $seasonName, $recipientFullName.pdf", 'base64', 'application/pdf');

$mail->isHTML( true );
$mail->Subject = "$categoryName $seasonName";
$mail->Body = ""; // contains html version of email (omitted for readability)
$mail->AltBody = "";

$mail->send();

任何想法如何解决这个问题?

0 个答案:

没有答案