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

How to send context specific values like name, prices and other invoice details #32

Closed
shivabhusal opened this issue Nov 30, 2015 · 1 comment

Comments

@shivabhusal
Copy link

In transactional email

<%body%>
Hello :name!, what's up
your number is :number.
This is the transactional footer

how to pass the variables :number, :name??

thanks,

@mklemme
Copy link

mklemme commented Jan 6, 2016

Those are passed in the sendgrid smtp headers defined in X_mailer.rb as an array of strings. The format you define the placeholders in your email content should match the substitution tag's key. So ":name" wouldn't work if your headers had "%name%"

headers "X-SMTPAPI" => {
    "sub": {
      ":name" => [user.name],
      ":number" => [amount]
    }.to_json

# the 'to' email can be overridden per action
mail(
  from: 'test@test.com',
  to: 'recipient@test.com',
  subject: "Hello World"
)

source: http://stackoverflow.com/questions/32790963/rails-mailer-using-sendgrid-template/34169292#34169292

documentation: https://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html

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

2 participants