简体   繁体   中英

PHP Mailer - Attachments not sending properly

When I send a message with a string attachment, the string attachment when opened only gives a 1 and in the email sorce it says

--b1_5a1a74831dfa0ce86353d222b95078c6
Content-Type: text/html; name="apperley-invoice-20017.html"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="apperley-invoice-20017.html"

MQ==


--b1_5a1a74831dfa0ce86353d222b95078c6--

Im using this code to add the attachment:

$mail->AddStringAttachment($invoicehtml,$filename,'base64','text/html');

我不确定问题的根源,但我认为您应该尝试使用SwiftMailer

Check out this here:

PHPMailer, AddStringAttachment and Data URI Scheme

Based on the fact that you are getting a base64 result, I'd imagine you either need to change the encoding method to quoted-printable or 8-bit, or decode the $invoicehtml first.

我敢打赌$ invoicehtml包含1.检查您的输入。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM