Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionMailer - limit on number of recipients?

I've got Capistrano set up to send emails after deploying my RoR (2.3.8) application. 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        '[email protected]'
    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, ["[email protected]", "[email protected]", etc.]
  CapMailer.deliver_deploy_notification(self)
end

Now this all works fine and dandy......until I put more than 7 email addresses in the :notify_emails array. Up to 7 works fine, but when I put 8 or more (all valid addresses), the email gets screwed up a little bit (still goes through to the first 7, at least). Looking at the email header, it shows that it is cutting off the 8th (and 9th, 10th, ...) address from the 'To:' and putting it in the message body.

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: [email protected]
To: [email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]
HEADER:

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

Deployed application...blah blah blah
BODY:

In addition, the subject does not appear on the email, even though the "error text" in the message body shows the correct subject.

Does anyone have any idea why this is happening? What is it about having 8 or more recipients that breaks it? I've Googled around and can't find anything about ActionMailer having a limit on the number of recipients (even if there were, that's a small limit). Is there something I'm missing? Any help is appreciated! I really need to be able to send to 8 or more recipients.

UPDATE: Setting the recipients directly with an array of 8 or more addresses still breaks things, so this clearly seems like a problem with ActionMailer and not Capistrano.

recipients ["[email protected]", "[email protected]", "[email protected]", "[email protected]", 
  "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"]
like image 627
istrasci Avatar asked Nov 03 '11 20:11

istrasci


1 Answers

The 7th email address is not followed by a comma, which could be the problem. Try passing a string to recipients, like cap_vars[:notify_emails].join(','), with no newlines.

like image 139
Jonathan Julian Avatar answered Oct 20 '22 15:10

Jonathan Julian