Reputation: 2409
I've only found solutions that work in Rails 3, so far. How can I force emails sent with ActionMailer to be formatted as HTML, rather than plaintext?
/app/models/franklin.rb (the mailer)
class Franklin < ActionMailer::Base
def activation(user)
recipients user.email
from "[email protected]"
content_type = "text/html"
subject "OnCampus @ RIT Registration"
body :user => user
end
end
/app/views/franklin/activation.html.erb
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
Hi <%= @user.full_name %>,
This is your activation email for OnCampus @ RIT. All you have to do is click the link below, and you'll be able to log in.
<%= link_to "Activate My Account!", "http://rit.oncampusapp.net/admin/activate?key=#{@user.activation_key}"%>
We hope to see you soon! :D
-- The OnCampus Team
</body>
</html>
Upvotes: 1
Views: 1555
Reputation: 21
Just paste this in your notifier/mailer model method - this will solve your problem
content_type "text/html"
Upvotes: 2
Reputation: 937
Have you tried setting in the activation action content_type "text/html" instead of content_type = "text/html"
Upvotes: 3