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

Add SendGrid template support. #163

Merged
merged 7 commits into from
Nov 8, 2016
Merged

Add SendGrid template support. #163

merged 7 commits into from
Nov 8, 2016

Conversation

rafroehlich2
Copy link
Contributor

The current implementation only allows using substitution tags on a specified template. This can be used as a jumping off point for future use of the x-smtpapi field.

@rafroehlich2
Copy link
Contributor Author

Outstanding issue is getting the raw JSON x-smtpapi passed without escape characters. SendGrid does not appear to handle them well.

@paulcsmith
Copy link
Contributor

This looks pretty cool and I can see how it would be useful for people. Can you confirm that you've tried this out and it works? I have a few style comments and questions that I'll try to leave in the next few days :D

@rafroehlich2
Copy link
Contributor Author

I can confirm that the template functionality works. Looking forward to the feedback!

@@ -107,6 +107,7 @@ defmodule Bamboo.SendgridAdapter do
|> put_subject(email)
|> put_html_body(email)
|> put_text_body(email)
|> put_x_smtp_api(email)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about maybe_put_x_smtp_api so it's clear that it may or may not happen?

@paulcsmith
Copy link
Contributor

Hey @rafroehlich2 Thanks a ton for this. I left some comments on it. Let me know if you have any questions. I'm excited to get this in :D

"""
def substitute(email, tag, value) do
case is_binary(tag) do
false ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a boolean I think an if might make more sense here

if is_binary(tag) do
  # send it...
else
  # raise...
end

@paulcsmith
Copy link
Contributor

I think this looks great! I (hopefully) answered your question and left a couple comments. I'll merge once the error is added. Thanks so much for this (and sorry for the late response. Been a bit busy this summer :D)

@rafroehlich2
Copy link
Contributor Author

No worries. The error in the tests are a result of the ExMachina issue #145. The individual tests for SendgridAdapter and SendgridHelper all test green. I will change the dependency version once it is updated with the fix.

@paulcsmith
Copy link
Contributor

@rafroehlich2 I believe you can rebase against the latest on master and it should pass on CI! If it does I'll go ahead and merge this in. Thanks for your work on it 🎉

@rafroehlich2
Copy link
Contributor Author

One more fix coming down the pipe so hold off merging.

@paulcsmith
Copy link
Contributor

I also think this might need to be rebased because there are a bunch of commits in this PR

This allows a person to substitute these fields and not have to supply an empty string for each.
@rafroehlich2
Copy link
Contributor Author

This is ready to be merged. Let me know if you want this further rebased.

@madshargreave
Copy link

Status on merge?

@paulcsmith
Copy link
Contributor

Thank you so much @rafroehlich2! I think this will be very helpful to SendGrid users

@paulcsmith paulcsmith merged commit 76c75d7 into beam-community:master Nov 8, 2016
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

Successfully merging this pull request may close these issues.

3 participants