gpt4 book ai didi

ruby-on-rails - Rails 4 Net::SMTPSyntaxError: 501 批量电子邮件的语法错误

转载 作者:行者123 更新时间:2023-12-04 12:53:19 24 4
gpt4 key购买 nike

我有一个每天发送时事通讯的 cronjob。由于某种原因,今天出现了错误。

我检查了堆栈跟踪并得到了这个

Net::SMTPSyntaxError: 501 Syntax error

from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:957:in `check_response'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:926:in `getok'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:869:in `rcptto'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:850:in `block in rcptto_list'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:848:in `each'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:848:in `rcptto_list'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:663:in `send_message'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:113:in `block in deliver!'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/smtp.rb:521:in `start'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:2141:in `do_delivery'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/mail-2.6.3/lib/mail/message.rb:236:in `block in deliver'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/actionmailer-4.1.8/lib/action_mailer/base.rb:527:in `block in deliver_mail'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications.rb:159:in `block in instrument'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications.rb:159:in `instrument'
... 3 levels...
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:43:in `require'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:43:in `block in exec_app_rails'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:32:in `loop'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/cli.rb:5:in `<top (required)>'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/bin/rails:9:in `require'
from /var/www/lsd-core/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/bin/rails:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.5/bin/rails:23:in `load'
from /usr/local/rvm/gems/ruby-2.1.5/bin/rails:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'

最初我认为这是收件人列表中的错误电子邮件格式,但是在清除了一些之后,我在手动运行时事通讯邮件程序后仍然会收到错误消息。

我尝试遍历每个收件人并向他们发送电子邮件,并且成功了!即使是糟糕的电子邮件。

使用 ActionMailer 发送时是否有最大收件人数?

最佳答案

据我所知,ActionMailer 对收件人数量没有限制。您收到的错误源自您的 SMTP 服务器,因此这很可能是故障所在。

发送多个 RCPT TO: 之一时返回错误命令在 net/smtp.rb:869 .最可能的解释是地址格式错误,但您声明每个地址在单独发送时都有效。您可以尝试将电子邮件发送到您自己的大量地址,看看是否会出现相同的错误。

无论您是否找到原因,您都可能需要考虑分别发送每份简报。如果避免了这样的故障,那么为每个收件人发送一封邮件的额外开销可能是值得的。祝你好运!

关于ruby-on-rails - Rails 4 Net::SMTPSyntaxError: 501 批量电子邮件的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31042502/

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