How to render rails mailer views in Mailgun HTTP API
I'm using Mailgun HTTP API to send emails from rails application.But I'm not able to render the mailer views. This is my mailer class. class MailgunMails < ActionMailer::Base def send_complex_message data = Multimap.new data[:from] = "Excited User <postmasters@#{@@domain}>" data[:to] = "alice@example.com" data[:subject] = "Hello" data[:html] = File.open("#{Rails.root}/app/views/mailgun_mails/send_complex_message.html.erb", 'r').to_s.html_safe ## also tried data[:html] = render(template: "send_complex_message.html.erb") response = RestClient.post "https://api:#{@@private_key}"\ "@api.mailgun