强制phpmailer以空体发送邮件 [英] Force phpmailer to send mail with empty body

查看:92
本文介绍了强制phpmailer以空体发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用phpMailer将pdf文件作为附件发送到传真网关.如果此电子邮件带有正文,则传真将在第二页显示此文本.

I need to send an pdf file as attachment to a FAX gateway using phpMailer. If this email has a body, the fax will have a second page with this text.

说:

$mail->Body = "";

php Mailer返回Message body empty

php Mailer returns Message body empty

如何强制phpMailer发送没有正文消息的电子邮件?

How can I force phpMailer to send emails without a body message?

这里是完整的代码

$mail = new PHPMailer();
$emailto = $_POST['sendto'].'@gateway.provider.xy';
$pdf_filename = 'PDF_list_'.date('dmY').'.pdf';
/*
STMP Auth...
*/
$mail->From = $fmail;
$mail->FromName = $row_firma['company'];
$mail->AddAddress($emailto);
$mail->AddAttachment($pdf_filename);
$mail->Subject = "Subject";
$mail->Body = "";
$mail->AltBody = "";
$mail->Send();

推荐答案

简单的解决方法:

$mail->AllowEmpty = true;

这篇关于强制phpmailer以空体发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆