我是 phpmailer 的新手,我可以发送电子邮件、带有附件的电子邮件和 .txt 文件的字符串附件,但是我不能发送带有 PDF 的字符串附件。电子邮件已发送,但 PDF 已损坏/无法打开。任何人都可以帮助发送附件是 PDF 而不是 .txt 的 AddStringAttachment 吗?谢谢
<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$body2 = "You are receiving this email because the Transfer Application submitted for $Name transferring to $Receiving is missing required documentation.
Please see the note below for details. The transfer application will not be reviewed until all of the necessary materials are received by the UHSAA.
<p> Details:
$Notes ";
$mail->IsSMTP();
$mail->AddAddress($emailp);
$mail->AddCC('transfers@uhsaa.org');
$mail->AddStringAttachment($body2, 'Filename.pdf', 'base64', 'application/octet-stream');
$mail->Subject = "Test";
$body = ("See attachment");
$mail->MsgHTML($body);
$mail->AddAddress($address);
$mail->AddCC($address);
if(!$mail->Send())
;
?>
同样,如果我只是将 Filename.pdf 更改为 Filename.txt 一切正常,所以我假设问题出在编码上,但我无法弄清楚。请帮忙,以便我可以发送字符串附件 PDF。谢谢。