Skip to content

Instantly share code, notes, and snippets.

@luctus
Created November 15, 2016 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luctus/a5f09f0e6bc7612d699f44f36bc957eb to your computer and use it in GitHub Desktop.
Save luctus/a5f09f0e6bc7612d699f44f36bc957eb to your computer and use it in GitHub Desktop.
Here you can see how to set parameters for the great Sendgrid's SMTP API (Take a look to lines 15-19) with Ruby on Rails
class ReportMailer < ApplicationMailer
def daily_email(report)
@report = report
@user = report.user
headers["X-SMTPAPI"] = {
category: report.category,
unique_args: { report: report.id, user: report.user.id }
}.to_json
mail(
to: report.recipients,
subject: report.name,
from: 'Dailytics.com <mailer@dailytics.com>'
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment