Mail not sending

I am having trouble with one of my notifications. For some reason it
doesn’t seem to even try and send. I have notifications in other
locations and they send just fine.

Here is the code that should call the notification:

if @post.save
  # We want to set the updated_at time if the post was saved
  # Updating the number of replies would be good too.
  Conversation.update(params[:conversation_id], { :updated_at =>

Time.now, :replies => replies })
User.update(session[:user].id, { :num_posts =>
(session[:user].num_posts += 1) })

  conv_owner = Conversation.find(params[:conversation_id]).user_id
  owner_email = User.find(conv_owner).email
  Notifications.deliver_new_thread_post(owner_email,

params[:conversation_id])

  if session[:conversation]
    redirect_to :controller => 'conversations', :action =>

‘show’, :id => session[:conversation]
end

Here is the Notification method:

def new_thread_post(to, conversation_id, sent_at = Time.now)
@subject = “Someone has posted to your thread”
@body[‘conversation_url’] = “http://happyleper.com/conversations/
show/#{conversation_id}”
@recipients = to
@from = ‘[email protected]
@sent_on = sent_at
@headers = {}
end

And the template:

There has been a reply to your thread at:

<%= @conversation_url %>

When I make a thread post the code inside the if is run but I don’t
see anything in the logs about the notification sending or failing.
There is no postfix activity in /var/log/messages though so it would
appear that it doesn’t run or dies before trying to send the email.

Any ideas?

Thanks.

Thanks, I’ll toy around with it when I get home from work. Hopefully
it is just a formatting issue. Mail sends fine when an account is
created and when a user requests their log-in info.

Is there a way to turn on more verbose logging, specifically for
notifications?

On Mon, 2008-02-04 at 17:30 -0800, Glen wrote:

Time.now, :replies => replies })
‘show’, :id => session[:conversation]
show/#{conversation_id}"

Any ideas?


are you configured to do e-mail in environment.rb ?

something like this?

Include your app’s configuration here:

ActionMailer::Base.smtp_settings = {
:address => “My_SMTP_SERVER”,
:port => 25,
:domain => “example.com
#:user_name => “[email protected]”,
#:password => “mypass”,
#:authentication => :login
}

also, this doesn’t appear to be valid in your example…

@body[‘conversation_url’] =
http://happyleper.com/conversations/show/#{conversation_id}

Craig