I have a mail program that I see in my journal sent, but the body of the letter does not contain anything from the view of the mail program.
This is because I put things in subfolders, and I tried to use :template_pathin my function mail, but to no avail.
application / senders / marketing / marketing_mailer.rb
class Marketing::MarketingMailer < ActionMailer::Base
require 'mail'
address = Mail::Address.new "test@example.com"
address.display_name = "Text"
address.format
default from: address
def contact(name, email, message)
@name = name
@email = email
@message = message
mail(:subject => "Test", :to => 'test@example.com', :reply_to => @email)
end
end
/app/views/marketing/marketing_mailer/contact.html.erb
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
<p>Name: <%= @name %></p>
<p>Email: <%= @email %></p>
<p>Message: <%= @message %></p>
</body>
</html>
I noticed that the developer has mailer views inside / views / devise / mailers / ... so I know this is possible, but I'm not sure how to do it.
source
share