草庐IT

php - 使用Mail_Mime发送附件到GMail,收到 "noname"附件

我有一个非常简单的网站表单,可以包含附件。它使用gmail的smtp发送到一个gmail地址。一切都很好,除了文件以“noname”的形式到达——没有文件名或扩展名。如果您下载附件并使用正确的文件名对其重命名,则该文件可以正常打开。我已经尝试向addAttachment()添加更多参数,例如文件类型和文件名,但它们没有显示在电子邮件中。当我在gmail中点击“显示原件”时,这就是我在附件部分看到的全部内容(无论我使用什么参数,它们都没有改变):Content-Transfer-Encoding:base64Content-Type:application/octet-streamCon

linux mail < file.log 有 Content-Type : application/octet-stream (a noname attachment in Gmail)

我一直在用mail-s"hereisalogfile""person@example.com"过去是通过标题来实现的:User-Agent:Heirloommailx12.47/29/08MIME-Version:1.0Content-Type:text/plain;charset=us-asciiContent-Transfer-Encoding:7bit但现在文件变长了,我得到的是无名附件,因为这样:User-Agent:Heirloommailx12.47/29/08MIME-Version:1.0Content-Type:application/octet-streamCont