scienceexchange / postmark_mailer

Send transactional emails with your Postmark templates in Rails!
MIT License
9 stars 3 forks source link

Clarifying prevent delivery usage #5

Open oyeanuj opened 6 years ago

oyeanuj commented 6 years ago

Hi folks, quick question - I see that there was a PR to prevent delivery of the messages but I wasn't quite sure how it should be used? Based on the test, it seems like one would need to declare a prevent_delivery method in the PostMark module. Is that correct?

If yes, thoughts on instead making it one of the options passed in to the mail method?

Thank you!

SeriouslyAwesome commented 6 years ago

Hey @oyeanuj sorry for the severely late response to this. The idea would be that you could define a prevent_delivery? method in your mailer subclasses based on whatever logic you want, and the PostmarkMailer::Base class would honor it. For instance, we use this on ScienceExchange.com to honor users' email preferences. I agree that it would probably be helpful to add it as an option to pass in for each individual mailer action for more granular control, but I don't think I'll be able to get to that any time soon. If you were to open a PR to implement this, I would be happy to review it.

SeriouslyAwesome commented 6 years ago

@oyeanuj I've added some documentation to the README covering basic usage of the #prevent_delivery? method.