【问题标题】:PhpMailer, sent attachment as other namePhpMailer,以其他名称发送附件
【发布时间】:2013-05-22 11:33:00
【问题描述】:

我使用 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

这个怎么做?

【问题讨论】:

    标签: php email phpmailer


    【解决方案1】:

    将所需名称作为第二个参数传递

    $mail->AddAttachment($file, "newName.csv");
    

    【讨论】:

      猜你喜欢
      • 2011-10-05
      • 2012-09-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多