Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PhpMailer,以其他名称发送附件_Php_Email_Phpmailer - Fatal编程技术网

PhpMailer,以其他名称发送附件

PhpMailer,以其他名称发送附件,php,email,phpmailer,Php,Email,Phpmailer,我使用phpmailer发送带有附件的电子邮件 file = "/path/bla.csv"; require 'class.phpmailer.php'; $mail = new PHPMailer(); // some oprtions here $mail->AddAttachment($file); $mail->Send(); 因此,如果使用此代码,电子邮件将与附加文件一起发送,文件名为:bla.csv 是否可以在不

我使用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");