ActionMailer - limit the number of recipients?

I have Capistrano to send emails after deploying my RoR application (2.3.8). I have a config/cap_mailer.rb file that basically looks like:

 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 

Then in my deploy.rb file I have the following:

 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 

Now everything works fine and dandy ...... until I put more than 7 email addresses in the array : notify_emails . Up to 7 works fine, but when I put 8 or more (all valid addresses), the letter is screwed up a bit (it still reaches the first 7, at least). Looking at the email header, it shows that it disconnects the 8th (and 9th, 10th, ...) address from "To:" and puts it in the body of the message.

HEADER:
thread-index: AcyaZxlga08L9p35QYKJ22aiGG2zeA ==
Content-Class: urn: content-classes: message
Importance: Normal
Priority: Normal
X-MimeOLE: Produced ...
Received: from exchange.my.org ([ip address]) by ...; Thu, 11/3/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; encoding = UTF-8
Return-Path: deploy@my.org
X-OriginalArrivalTime: November 03, 2011 8:28 p.m. 08.0494 (UTC)
FILETIME = [19601CE0: 01CC9A67]

Deployed application ... blah blah blah
BODY:

In addition, the object is not displayed in the message, although the text of the error message in the message body shows the correct object.

Does anyone know why this is happening? What happens if 8 or more recipients violate this? I googled around and can't find anything about an ActionMailer that has a limit on the number of recipients (even if it were, this is a small limit). Is there something I'm missing? Any help is appreciated! I really need to be able to send 8 or more recipients.

UPDATE: Configuring recipients directly with an array of 8 or more addresses still interrupts, so this clearly looks like a problem with ActionMailer and not with Capistrano. p>

 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 "] 
+6
source share
3 answers

The 7th email address is not followed by a comma, which may be a problem. Try passing the string to recipients , for example cap_vars[:notify_emails].join(',') , without a new line.

+1
source

Try passing the string to recipients without commas (there were messages about commas as a problem), for example:

 cap_vars[:notify_emails].join(' ') 
0
source

With all due respect, some simple things you might miss when debugging complex errors:

  • If the associated mail server installs it on another production server? If you are not sure if the mail server looking for another error may not help.
  • Try updating rails / ruby? Perhaps this is a bug in the code
-1
source

Source: https://habr.com/ru/post/900733/


All Articles