Ruby on Rails Wednesday, May 23, 2012

Hey,

I'm Swift, one of the developer evangelists over at SendGrid.  Sorry
that we didn't get back to you on our support channel - we get a high
volume of requests and sometimes things slip through the cracks.

Your problem is that you're using a deprecated syntax for composing
the email. The preferred method is to use the mail function:

def
registration_confirmation(user)·
mail(:from => 'Foo
<info@foo.com>',
:subject => "Welcome to Foo,
#{user.first_name}!",
:to => "#{user.first_name} <#{user.email}
>")
end

You can find the docs for ActionMailer here:
http://guides.rubyonrails.org/action_mailer_basics.html

They're pretty extensive and definitely worth the read.

Let me know if you have any more issues!

- Swift

On May 22, 8:12 pm, yellowreign <ryanac...@gmail.com> wrote:
> I'm a Rails newbie using version 3.1.4 for my Heroku (Cedar stack) app.
>  I'm trying to figure out why my app is sending blank emails using
> Sendgrid, and I haven't had much success with their support after raising a
> ticket three business days ago, so I'm hoping someone here might be able to
> help (tried searching the net and this group for blank emails, as well as
> posting on Stackoverflow, too).
>
> I'm connecting to Sendgrid OK because the emails are sending...they're just
> blank (actually in hotmail the body says "This is a multi-part message in
> MIME format...
>
> ----." and there's a small attachment in gmail that has that same text - in Yahoo mail it's blank though).
>
> I followed these directions (https://devcenter.heroku.com/articles/sendgrid),
> so I have:
>
> my initializer/mail.rb
>
> ActionMailer::Base.smtp_settings = {  :address        => 'smtp.sendgrid.net',  :port           => '587',  :authentication => :plain,  :user_name      => ENV['SENDGRID_USERNAME'],  :password       => ENV['SENDGRID_PASSWORD'],  :domain         => 'heroku.com'}ActionMailer::Base.delivery_method = :smtp
>
> My mailer (notifier.rb), like this:
> class Notifier < ActionMailer::Base
>
>   helper :application
>   default_url_options[:host] = "foo.com"
>
> def registration_confirmation(user)
>     from          'Foo <i...@foo.com>'
>
>     @user = user
>     subject     "Welcome to Foo, #...@user.first_name}!"
>     recipients  "#...@user.first_name} <#...@user.email}>"
>     sent_on     Time.now
>   end
>
> a text version (registration_confirmation.text.erb and an html
> version registration_confirmation.html.erb).
>
> when I check the Heroku logs, it doesn't report any errors and it indicates
> both views rendered successfully.  I have put the who output from the logs
> in this gist:https://gist.github.com/2765790
>
> If someone could please help this newbie learn what he's doing wrong, that
> would be hugely appreciated.  Thank you!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment