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 = ''info-ZMfTK6ahfJ++XT7JhA+gdA@public.gmane.org'' @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. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mon, 2008-02-04 at 17:30 -0800, Glen wrote:> 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 = ''info-ZMfTK6ahfJ++XT7JhA+gdA@public.gmane.org'' > @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?---- 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 => "me-S7oGPHmddGo0aPf6s/0I7w@public.gmane.org", #: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 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
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 Feb 5, 9:59 am, Craig White <cr...-CnJ8jr4MGtxl57MIdRCFDg@public.gmane.org> wrote:> On Mon, 2008-02-04 at 17:30 -0800, Glen wrote: > > 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 = ''i...-ZMfTK6ahfJ++XT7JhA+gdA@public.gmane.org'' > > @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 notificationsendingor 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? > > ---- > are you configured to do e-mailin 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 => "m...-S7oGPHmddGo0aPf6s/0I7w@public.gmane.org", > #: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--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---