Rails sends one email to many: bcc VS sends multiple emails one at a time:

I need to send batch emails to several hundred site members. There seem to be two decent Rails ways :


Easy way: bcc

When we send an email once to everyone using :bcc like this:

 def send_announcement users = User.all.pluck(:email) mail bcc: users, subject: 'yolo' end 
  • Advantages : we send only 1 email and it is pleasantly fast
  • Disadvantages . I am afraid to use :bcc because I have not done this before.

The hard way:

Where we send 468 emails, one at a time like this:

 def send_announcement User.all.pluck(:email) |email| mail to: email, subject: 'yolo' end end 
  • Advantage . Each user receives their own email address (for example, earlier).
  • Disadvantage : much more work on configuring Sidekiq, ActiveJob, and wasting time to make sure repeat queues are working correctly.

I have a few questions:

  • Is it common to send emails with :bcc ?
  • Are there any laws against using: bcc to send periodic emails like this?
  • Can something work wrong when using :bcc this way? Is it possible to leak / reset user email addresses?
  • Are there any decent reasons to NOT do this with :bcc
  • Are you allowed to send email using bcc without setting an address - to ?

The only personal information in any of these email messages is the users email address. :bcc always hide it? The reason I'm asking about this is the full list of recipients :bcc when I look at the email address: localhost: 3000 / rails / mailers / announcements_mailer / send_announcement.html

Suppose that I have already installed and activated Sidekiq, and it will take 1-2 hours to complete the difficult journey (for example, sending several separate letters with deliver_later ), which will be better? I do not think about scalability here, since we have juice to make it difficult. I'm just trying to find out if a simple way (way: OSK) is made easy?

I am addicted to one email using a simple method :bcc

+5
source share

Source: https://habr.com/ru/post/1273423/


All Articles