当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby on rails 3 - Sendgrid Multipart emails Blank from Heroku

问题描述:

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 <[email protected]>'

@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.

I posted the html here.

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: "[email protected]") at the end of the method.

分享给朋友:
您可能感兴趣的文章:
随机阅读: