0

I have a live app (livebytransit.com) and I recently switched to a custom domain instead of simply forwarding with cloaking. The domain is with Godaddy. Everything is looking good, except for my mailers no longer work!

Here is the error from heroku logs:

2012-01-03T22:36:17+00:00 app[web.1]: Rendered showing_mailer/showing_request.html.erb (0.5ms)
2012-01-03T22:36:17+00:00 app[web.1]: 
2012-01-03T22:36:17+00:00 app[web.1]: Sent mail to info@livebytransit.com (213ms)
2012-01-03T22:36:17+00:00 app[web.1]: Completed 500 Internal Server Error in 242ms
2012-01-03T22:36:17+00:00 app[web.1]: EOFError (end of file reached):
2012-01-03T22:36:17+00:00 app[web.1]:   app/controllers/showings_controller.rb:12:in `create'

From my production.rb config file:

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp

Initializer:

ActionMailer::Base.smtp_settings = {
  :address  => "smtpout.secureserver.net",
  :port  => 25,
  :user_name  => "username",
  :password  => "password",
  :authentication  => :login
}

Mailer:

class InviteeMailer < ActionMailer::Base
  default from: "admin@livebytransit.com"

  def send_invite(invitee)
        @invitee = invitee
        mail(:to => @invitee.email, :subject => "You have been Invited")
  end

end

Finally the controller:

def create
    @invitee = Invitee.new
    @invitee.email = (params[:email])
    @invitee.user_id = session[:user_id]
    @invitee.save
    InviteeMailer.send_invite(@invitee).deliver
    redirect_to user_url(session[:user_id]), :notice => "Invitation Sent, thank you!"
  end

The invitee is getting saved, but the mail does not go due to EOFError. This smells like a configuration problem to me, but I can't seem to figure it out, any thoughts would be mucho appreciated! Again, the mailer was working just fine until I switched to the custom domain.

一二三
  • 21,059
  • 11
  • 65
  • 74
tomb
  • 1,374
  • 1
  • 13
  • 23

1 Answers1

0

The heroku help desk suggested I add sendgrid. So I added sendgrid, then the error changed to this:

Net::SMTPFatalError (553 Sorry, your envelope sender is in my badmailfrom list

This error prompted me to set up an email address for the default "from" address as shown in the Mailer.

Problem solved.

I am not sure why the emails were being delivered when the app was deployed to the default myapp.herokuapp.com. The problem only came up after switching to my custom domain.

tomb
  • 1,374
  • 1
  • 13
  • 23
  • The error came back, and this time I reconfigured sendgrid using this question: http://stackoverflow.com/questions/8782274/sendgrid-email-sending-issues-in-ruby-on-rails-hosted-on-heroku. Works like a charm. – tomb Mar 04 '12 at 19:51