PhpMailer,发送附件作为其他名称
发布时间:2020-12-13 18:21:51 所属栏目:PHP教程 来源:网络整理
导读:我使用phpmailer发送带附件的电子邮件 file = "/path/bla.csv"; require 'class.phpmailer.php'; $mail = new PHPMailer(); // some oprtions here $mail-AddAttachment($file); $mail-Send(); 因此,如果使用此代码,则使用附件文件发送电子邮件,文件名为:bl
我使用phpmailer发送带附件的电子邮件
file = "/path/bla.csv"; require 'class.phpmailer.php'; $mail = new PHPMailer(); // some oprtions here $mail->AddAttachment($file); $mail->Send(); 因此,如果使用此代码,则使用附件文件发送电子邮件,文件名为:bla.csv 有没有重命名真实文件可以更改附件文件名?也就是说,我需要发送bla.csv文件,但发送名称为some_other_name.csv 怎么做到这个?
将所需名称作为第二个参数传递
$mail->AddAttachment($file,"newName.csv"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |