Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should deliver and deliver_async noop if all recipients are blank? #24

Closed
paulcsmith opened this issue Dec 9, 2015 · 2 comments
Closed
Milestone

Comments

@paulcsmith
Copy link
Contributor

While using this in one of our applications we had to do something like this

users = Repo.all(User)

if length(users) > 0 do
  Emails.welcome_email(users) |> Mailer.deliver_async
end

Maybe deliver_async should throw a warning? Maybe an option to allow empty_recipients?

deliver_async(allow_empty_recipients: true)

Maybe this could be done at the mailer level via an option?

defmodule MyApp.Mailer do
  use Bamboo.Mailer, otp_app: :my_app

  @allow_empty_recipients true
end
@paulcsmith
Copy link
Contributor Author

Maybe it should raise only if the to, bcc or cc is nil since by default those are empty lists.

If you do something like a wrote above it would still be an empty list, whereas setting it to nil probably means there was a problem where you expected the recipient to be something and it was accidentally nil.

@paulcsmith paulcsmith added this to the Ready for public release milestone Feb 3, 2016
@paulcsmith
Copy link
Contributor Author

Decided on: #40 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant