Sending email with ActionMailer after a deploy

60 views
Skip to first unread message

istrasci

unread,
Nov 4, 2011, 6:30:31 PM11/4/11
to Capistrano
I've having a strange issue where I set up a class CapMailer <
ActionMailer::Base with a method to deliver email as such:

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


Then I make a capistrano task to call this after a deploy:

after "deploy", "deploy:notify"
task :notify do
puts " * Sending notification email"
set :notify_emails, ["te...@my.org", "te...@my.org", etc.]
CapMailer.deliver_deploy_notification(self)
end

The problem is, when I set the :notify_emails array of addresses, if I
put 8 or more addresses, the email gets screwed up. 7 or fewer seems
to work fine. But with 8 or more, the email addresses of the first 7
are correctly put in the "To:" spot of the email, but all others get
pushed into the email body. See more detail at
http://stackoverflow.com/questions/8001731/actionmailer-limit-on-number-of-recipients
.

Anyone know why this is happneing? Please help, this is really
frustrating.

- Ian

Lee Hambley

unread,
Nov 5, 2011, 6:47:47 AM11/5/11
to capis...@googlegroups.com
Sorry Ian, CapMailer isn't anything official, you'll have to reach out to the maintainer directly. Good Luck!

istrasci

unread,
Nov 5, 2011, 3:04:29 PM11/5/11
to Capistrano
No, CapMailer is a class I made. ActionMailer::Base requires that the
'recipients' be either a) a single address as a string, or b) an array
of string addresses. So I guess my question is, is there some weird
thing that Capistrano does in the set :notify_emails,
["te...@my.org", "te...@my.org", etc.]  that somehow makes it an
unacceptable format for ActionMailer::Base?? Does the 'set' method
freak out over arrays of a certain size, etc.?

I'm just not sure if this "anomaly" is being caused by Capistrano or
ActionMailer::Base.

istrasci

unread,
Nov 7, 2011, 1:13:07 PM11/7/11
to Capistrano

Hmm, it seems that putting an array of 8 email addresses directly into
the 'recipients' doesn't work either. So it seems the problem is
ActionMailer, not Capistrano; unless some weird behaviour is
introduced into ActionMailer simply by being invoked from Capistrano.
But I'm betting that's not the case.

Thanks for your help anyway.

- Ian
Reply all
Reply to author
Forward
0 new messages