I was using only html emails which worked from my Rails 3.1.4 app, but I decided to add text only emails to make them multipart and now the email arrives blank. I also started using Sendgrid’s Heroku addon – not sure if that is part of it.
When I look in my heroku logs, I can see that both views, the .erb and .html.erb rendered successfully and I don’t see any errors. The email arrives, but the body is blank in Yahoo! and in Hotmail it only says (didn’t do any more testing):
This is a multi-part message in MIME format...
----
here’s my mailer:
class Notifier < ActionMailer::Base
helper :application
default_url_options[:host] = "foo.com"
# email on new user registration to verify user
def verification_instructions(user)
subject "Email Verification"
from 'Bar <info@bar.com>'
@user = user
recipients "#{user.first_name} <#{user.email}>"
sent_on Time.now
@url = "http://bar.com/user_verifications_controller/show/#{user.perishable_token}"
end
The text version (.erb)
Hi <%= @user.username %>, thanks for signing up
Please click the following link to verify your email address:
<%= @url %>
If the above URL does not work, try copying and pasting it into your browser. If you continue to have problems, please feel free to contact us.
Also, when I send the email from the console in development, I can look in the logs and see that renders the email. I put the output here. Tried a different email to make sure that it wasn’t an issue specific to one email2
Thanks in advance, for any help you can provide.
I just started using Sendgrid too….
I’m using the sendgrid gem
My Mailers have
“include SendGrid” at the top
and an exclpicit call to mail(subject: “Yadda”, to: “recipient@mail.com”) at the end of the method.