mailjet / mailjet-gem

[API v3] Mailjet official Ruby GEM
https://dev.mailjet.com
Other
130 stars 72 forks source link

add instructions to override settings using ActionMailer callbacks #176

Open jgigault opened 5 years ago

jgigault commented 5 years ago

Note: This commit also includes an update of .gitignore file for IntelliJ IDEs users

I was looking for a solution to temporary override Mailjet credentials without having to specify api_key and secret_key params within delivery_method_options of all my mailers. The idea of using callbacks is to keep the mailers very clean, but it requires to manually map Mailjet settings with raw user_name and password SMTP settings.

I am wondering if this tip should be part of the README, but I wanted to share it to you.
Please give me feedbacks if you think about a better integrated solution.

francois-ferrandis commented 4 years ago

I was faced with the exact same problem, and since the Rails documentation is misleading on this matter, it took me a while to realize I could use an after_action callback.

In my opinion, this PR should be merged. :+1:

Note : @jgigault perhaps you could rebase and push --force so it would trigger the CI again and probably pass! :wink:

jgigault commented 3 years ago

Nice to see you there @francois-ferrandis :-) Now I am feeling not alone with my proposal!

boardfish commented 3 years ago

I experienced #219 while trying to implement something along these lines.