Last active
December 30, 2019 11:14
-
-
Save nburkley/d0f7d1b5b12fc9832404e7e28b42d02e to your computer and use it in GitHub Desktop.
Use `bbc` instead of `to` to hide list of recipienta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users_by_locale.each do |locale, locale_users| | |
I18n.with_locale(locale) do | |
mail( | |
bcc: locale_users.map(&:email), | |
subject: I18n.t('user_mailer.new_follower.subject') | |
) | |
end | |
end | |
private | |
def users_by_locale | |
@users.group_by { |user| user.locale } | |
end |
@glaszig, good point — I've updated the gist to use bbc
instead of to
. Thanks for bringing it to my attention.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
careful! this will leak all your users email addresses to all of them since most mail servers will just send the
:to
addresses as part of every mail. you should be using a combination of oneto
address and many other:bcc
address. or send them all separately in a background process.