Hi there

I'm using the sendgrid basic addon and I'm a little stumped.  I get a
500 error when sending mail from my custom domain, but not from
myapp.heroku.com.

My mailer is very simple - an observer that sends out email on save of
an AR object.  And like I said, everything works just fine when I'm
navigating the app using the myapp.heroku.com domain.

I've set config.action_mailer.raise_delivery_errors = true in
production.rb

But heroku logs show me nothing.  Here's what I see in the logs after
a restart of the app and then a test resulting in the 500 error.

Otherland:$ heroku logs
==> production.log <==
# Logfile created on Tue Dec 08 08:24:18 -0800 2009
==> dyno-455072.log <==
Otherland:$

If I use the heroku console to create the AR object mail is sent just
fine.  Here's what that looks like:

>> Contact.inspect
=> "Contact(id: integer, name: string, email: string, message: text,
created_at: datetime, updated_at: datetime)"
>> Contact.create!(:name=>'foo', :email=>'f...@bar.com', message=>'hello world')
NameError: undefined local variable or method `message' for #<Object:
0x2b6a4f52a348 @heroku_console_output=[]>
>> Contact.create!(:name=>'foo', :email=>'f...@bar.com', :message=>'hello 
>> world')
=> #<Contact id: 6, name: "foo", email: "f...@bar.com", message: "hello
world", created_at: "2009-12-08 16:28:44", updated_at: "2009-12-08
16:28:44">
>>

My controller is pretty basic...

class ContactsController < ApplicationController
  def create
    @contact = Contact.create!(params[:contact])
    flash[:info] = 'Your message has been sent. Thanks!'
    redirect_to contact_path(@contact)
  end
end

My observer:

class ContactObserver < ActiveRecord::Observer
  def after_create(contact)
    ContactMailer.deliver_contact_message(contact)
    contact.logger.info("Contact from #{contact.name} sent")
  end
end

My mailer:

class ContactMailer < ActionMailer::Base
  def contact_message(contact)
    recipients 'aliciac...@yahoo.com'
    bcc 'la...@shovelpunks.com'
    subject "New aliciachatham.com Message from #{contact.name}"
    from 'mai...@aliciachatham.com'
    body :contact=>contact
  end
end


This is all Rails 101 stuff, so I'm baffled as to why it's not
working.  Can anyone point me in the right direction?  I'm at a bit of
a loss at this point.

Thanks,
Lance

--

You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.


Reply via email to