gpt4 book ai didi

ruby-on-rails - ActionMailer - 限制收件人数量?

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

我已将 Capistrano 设置为在部署我的 RoR (2.3.8) 应用程序后发送电子邮件。我有一个 config/cap_mailer.rb文件基本上如下所示:

ActionMailer::Base.smtp_settings = {
:address => my,
:port => exchange,
:domain => server,
:authentication => settings,
:user_name => are,
:password => here
}

class CapMailer < ActionMailer::Base
def deploy_notification(cap_vars)
recipients cap_vars[:notify_emails]
from 'deploy@my.org'
subject "New app!"
body "Deployed application...blah blah blah"
end
end

然后,在我的 deploy.rb 中文件,我有以下内容:
require 'config/cap_mailer.rb'
...
desc "Email recipients of deployment"
task :notify do
puts " * Sending notification email"
set :notify_emails, ["test1@my.org", "test2@my.org", etc.]
CapMailer.deliver_deploy_notification(self)
end

现在这一切都很好,花花公子......直到我在 :notify_emails 数组中放入了 7 个以上的电子邮件地址。最多 7 个工作正常,但是当我输入 8 个或更多(所有有效地址)时,电子邮件会变得有点困惑(至少仍然会到达前 7 个)。查看电子邮件标题,它表明它正在从“收件人:”中截取第 8 个(以及第 9 个、第 10 个……)地址并将其放入邮件正文中。

HEADER:
thread-index: AcyaZxlga08L9p35QYKJ22aiGG2zeA==
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By ...
Received: from exchange.my.org ([ip address]) by ...; Thu, 3 Nov 2011 14:28:08 -0600
Date: Thu, 3 Nov 2011 14:28:08 -0600
From: deploy@my.org
To: test1@my.org,
test2@my.org,
test3@my.org,
test4@my.org,
test5@my.org,
test6@my.org,
test7@my.org
HEADER:

BODY:
test8@my.org
Message-Id:
<4eb2f95816341_135ff800c21ac130@my_box.local.tmail>
Subject: New app!
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Return-Path: deploy@my.org
X-OriginalArrivalTime: 03 Nov 2011 20:28:08.0494 (UTC)
FILETIME=[19601CE0:01CC9A67]

Deployed application...blah blah blah
BODY:



此外,即使邮件正文中的“错误文本”显示了正确的主题,主题也不会出现在电子邮件中。

有谁知道为什么会这样?有 8 个或更多的收件人破坏了它是什么意思?我在谷歌上搜索过,找不到任何关于 ActionMailer 对收件人数量有限制的信息(即使有,那也是一个很小的限制)。有什么我想念的吗?任何帮助表示赞赏!我真的需要能够发送给 8 个或更多的收件人。

更新:设置 收件人直接使用 8 个或更多地址的数组仍然会破坏事情,所以这显然是 ActionMailer 而不是 Capistrano 的问题。
recipients ["test1@my.org", "test2@my.org", "test3@my.org", "test4@my.org", 
"test5@my.org", "test6@my.org", "test7@my.org", "test8@my.org", "test9@my.org"]

最佳答案

第 7 个电子邮件地址后面没有逗号,这可能是问题所在。尝试将字符串传递给 recipients , 喜欢 cap_vars[:notify_emails].join(',') ,没有换行符。

关于ruby-on-rails - ActionMailer - 限制收件人数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8001731/

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