gpt4 book ai didi

actionmailer - 发送带有文本附件的电子邮件时为 "Missing start boundary"

转载 作者:行者123 更新时间:2023-12-04 18:10:21 25 4
gpt4 key购买 nike

我在发送带有文本附件的电子邮件时遇到问题(没有附件,一切都很好)。我正在使用 actionmailer 3.2.11 并尝试通过 Amazon SES 发送电子邮件。在我看来,亚马逊 snmp 服务器对我生成的电子邮件有问题。生成电子邮件的代码如下所示:

class ServiceMailer < ActionMailer::Base
default from: "noreply@dungeonpilot.com"


def server_crashed log_file_names
attachments[ 'foo.txt' ] = 'Hallo'
mail to: 'Txxx@xxzki.de', subject: '[dungeonpilot] Server Crashed'
end
end

发送邮件时的错误信息:Net::SMTPFatalError: 554 Transaction failed: Missing start boundary

生成的邮件是这样的:

Date: Fri, 08 Feb 2013 10:11:09 +0000
From: noreply@dungeonpilot.com
To: Txxx@xxxzki.de
Message-ID: <5114cf3dc4886_701165e7f848869@ip-10-62-103-46.mail>
Subject: [dungeonpilot] Server Crashed
Mime-Version: 1.0
Content-Type: multipart/mixed;
charset=UTF-8
Content-Transfer-Encoding: 7bit



--
Date: Fri, 08 Feb 2013 10:11:09 +0000
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=foo.txt
filename: foo.txt
Content-ID: <5114cf3d55085_701165e7f8487cc@ip-10-62-103-46.mail>

Hallo

----

将其作为测试邮件发送给 SES,也会导致“缺少起始边界”。所以我认为传递的内容一定有问题。

在 views 文件夹中,只有一个 .txt.erb 模板。我添加了一个 .html.erb 模板,现在有一个 boundary="-header 和邮件部分之间的边界:

Date: Fri, 08 Feb 2013 10:26:57 +0000
From: noreply@dungeonpilot.com
To: Torsten@Robitzki.de
Message-ID: <5114d2f1b8175_702812508041181@ip-10-62-103-46.mail>
Subject: [dungeonpilot] Server Crashed
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="--==_mimepart_5114d2f18f621_7028125080411632";
charset=UTF-8
Content-Transfer-Encoding: 7bit



----==_mimepart_5114d2f18f621_7028125080411632
Date: Fri, 08 Feb 2013 10:26:57 +0000
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=foo.txt
filename: foo.txt
Content-ID: <5114d2f0ee34b_7028125080411545@ip-10-62-103-46.mail>

Hallo

----==_mimepart_5114d2f18f621_7028125080411632
Date: Fri, 08 Feb 2013 10:26:57 +0000
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <5114d2f19ce45_7028125080411785@ip-10-62-103-46.mail>



----==_mimepart_5114d2f18f621_7028125080411632--

看起来像是 ActionMailer 中的错误?

最佳答案

当电子邮件文本正文和电子邮件 HTML 正文为空时,我遇到了这个错误。所以其中一个在使用发送电子邮件时必须具有值(value)亚马逊简单电子邮件 SendRawEmailAsync 方法

关于actionmailer - 发送带有文本附件的电子邮件时为 "Missing start boundary",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14769269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com