perl發郵件附件亂碼問題

背景:code

    使用 Mail::sender 模塊的 MailFile 發送帶附件的郵件時,中文文件名出現部分亂碼的問題。ip

解決辦法:utf-8

    $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 => "文件名"
    });亂碼

相關文章
相關標籤/搜索