I've intergrated the sendgrid-ruby gem on my rails app and am trying to send an email I used to have sent via ActionMailer. I've used the example from sendgrid:
from = Email.new(email: 'test@example.com', name: 'Test Sender')
to = Email.new(email: 'test@example.com')
subject = 'This is a sendgrid test email'
content = Content.new(type: 'text/plain', value: 'and easy to do anywhere, even with Ruby')
mail = Mail.new(from, subject, to, content)
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.mail._('send').post(request_body: mail.to_json)
However, I'd like to replace the content with my old Mailer Templates I used in Rails. Is this possible?
You can use their SMTP API which allows you to define or use your email templates in your rails app.
example send guild ruby