perl发邮件附件乱码问题

背景:

    使用 Mail::sender 模块的 MailFile 发送带附件的邮件时,中文文件名出现部分乱码的问题。

解决办法:

    $sender->OpenMultipart({
          from => '发件人',
          to=>'收件人',
          smtp=>'smtp.exmail.qq.com',
          subject=>encode('MIME-B',decode('utf-8', "标题"))
    });
    $sender->Body({ msg => "邮件正文" });
    $sender->Attach({
      ctype => 'text/csv',
      encoding => '8BIT', # 指定 Content-Transfer-Encoding: 8BIT
      file => "文件名"
    });

转载于:https://my.oschina.net/u/1259707/blog/730317

你可能感兴趣的:(perl发邮件附件乱码问题)