Single visible recipient when mass-mailing using ActionMailer
I have a Rails 3 application that will send mails out to members of a group.
I would like to be able to send out the mails with a single ActionMailer call but specify all the recipients as an array of addresses, e.g.
Emailer.send_newsletters(['user1@domain.tld', 'user2@domain.tld'])
...
d开发者_Python百科ef send_newsletters(addresses)
mail :to => addresses, :subject => 'My newsletter to you'
end
Rails will by default make all the recipients visible when sending the mail but I would like that each recipient only sees his own name instead of all.
I will not use a dummy recipient and BCC all real recipients - it needs to be the right recipient.
Is there any way to send the mails without creating a loop around the addresses myself?
No, there isn't. You can send the email to a list of recipients, but they will see all the other recipients. You can assign the recipients to bcc, but the user won't see its address.
The only way to have the user see its own address is to loop all the elements and send one email for each recipient.
精彩评论