Is it possible to call the ActionMailer mail method multiple times from a single method? I'd like to send a number of similar emails, and would like to loop through the list of recipients and call mail once for each recipient.

I could push this up the stack to where the mailer class method is called and delivered, but I'd love to see a definitive answer about whether the mail method can be called multiple times in a single ActionMailer method.

To be explicit, this particular problem could not be solved by passing an array of addresses in the to, cc or bcc hash given to the mail method.

Either the mail method has to be called multiple times, or the ActionMailer class method would need to be called multiple times.

1 Answer
1

You can call the method multiple times. The only issue you could have is that, if you don't have a background task system (like Resque or Sidekiq or girlFriday) sending many mails during a web request may trigger a tiemout.