Tuesday, May 22, 2012

[Rails] Heroku App Sending Blank Emails with Sendgrid

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 <info@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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/4XeItiOhxgkJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate