Skip to content

Conversation

@tant42
Copy link

@tant42 tant42 commented Feb 10, 2015

Added support for sendgrid template engine by allowing us to enable it and adding a function to set the template_id.

Remove redundant json dependency from gemspec.

@nesrual
Copy link

nesrual commented May 16, 2015

+1 really useful

@Isildy
Copy link

Isildy commented Aug 13, 2015

Can you give an example of how to use it?

sh-ft added a commit to sh-ft/sendgrid that referenced this pull request Jan 28, 2016
Add support for sendgrid template engine.
@abhchand
Copy link

abhchand commented Mar 9, 2016

Is there an update on this? It's been open for over a year now and is a pretty core part of the API.

Also several people are migrating over from Mandrill to SendGrid given the recent news with Mandrill/MailChimp, so this is a critical requirement for newcomers. Not having the template feature available is definite deal breaker for those of us who store all our email templates vendor-side.

As for the requested example - the author should definitely be on the hook for filling out a description and example, but in this particular case the usage is almost identical to the other X-SMTPAPI functionality this gem provides.

It's also worth noting that there's been an almost identical PR to add this same functionality open for even longer, since 2014: #19

Thanks.

@LaurMo
Copy link

LaurMo commented Mar 9, 2016

+1 @abhchand

lib/sendgrid.rb Outdated

# Call within mailer method to set the template_id.
def sendgrid_template_id(template_id)
@gs_template_id = template_id
Copy link

Choose a reason for hiding this comment

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

Typo - should be @sg_template_id everywhere in this file

@Intrepidd
Copy link

👍 Would love to see that

@tant42
Copy link
Author

tant42 commented Apr 8, 2016

Pull request has been updated with test to demonstrate usage. (Basically in the mailer function you need to call:

  sendgrid_enable :templates
  sendgrid_template_id <the template uuid>

Use sendgrid_substitute to provide template values.

There's also a bit that's undocumented, but the only way I could get a template item to send correctly is with set the mail options "to" to "[email protected]" and use sendgrid_recipients to set who the emails send to. Otherwise, "to" person is set as the recipient for all people in the sendgrid_recipients list (at least when I first implemented this. That might have been fixed by now).

@gkunwar
Copy link

gkunwar commented Nov 24, 2016

@tant42 I really need this feature, how can I use this?

@tant42
Copy link
Author

tant42 commented May 4, 2017

Anything else I need to fix before this can be merged?

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.

7 participants