I have to send batch emails to several hundred site members. It seems there are two decent Rails ways
:
The easy way using :bcc
Where we send 1 email to everyone simultaneously using :bcc
like so:
def send_announcement
users = User.all.pluck(:email)
mail bcc: users, subject: 'yolo'
end
- Advantages: We only send 1 email, and it's nice a quick
- Disadvantages: I'm wary of using
:bcc
because I've never done it before.
The hard way using :to
Where we send 468 email, one at a time like so:
def send_announcement
User.all.pluck(:email) |email|
mail to: email, subject: 'yolo'
end
end
- Advantage: Each user gets their own email (like before)
- Disadvantage: Much more work setting up Sidekiq, ActiveJob, and spending time making sure retry queues work properly
I have a few questions:
- Is it common to send batch emails using
:bcc
? - Are are there any laws against using :bcc to send batch emails like this?
- Can anything go wrong when using
:bcc
in this way? Is it possible to leak/bleed user email addresses? - Are there any decent reasons NOT to do it with
:bcc
- Are you 'allowed' to send an email using
bcc
without setting a -to
address?
The only personally identifiable information in any of these email is the users email address. Does :bcc
always hide this? The reason I ask specifically about that is I can see the full list of :bcc
recipients when I preview the email at: localhost:3000/rails/mailers/announcements_mailer/send_announcement.html
Supposing I already have Sidekiq set up and enabled, and that it will only take 1 or 2 hours to implement the hard way, (i.e. sending multiple individual emails with deliver_later), which option would be better? I'm not thinking about scalability here as we have the juice to do it the hard way. I'm just trying to figure out if the easy way (the :bcc way) is frowned upon or not?
I'm keen on the single email using the easy :bcc
technique