Hi, I''ve setup Action Mailer today to email the contents of a form. Every seemes fine except when the email is sending. Here is the error I get on the production server: SocketError (getaddrinfo: Name or service not known): /usr/lib/ruby/1.8/net/protocol.rb:83:in `initialize'' /usr/lib/ruby/1.8/net/protocol.rb:83:in `new'' /usr/lib/ruby/1.8/net/protocol.rb:83:in `connect'' /usr/lib/ruby/1.8/net/protocol.rb:82:in `timeout'' /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'' /usr/lib/ruby/1.8/net/protocol.rb:82:in `connect'' /usr/lib/ruby/1.8/net/protocol.rb:64:in `initialize'' /usr/lib/ruby/1.8/net/smtp.rb:393:in `open'' /usr/lib/ruby/1.8/net/smtp.rb:393:in `do_start'' /usr/lib/ruby/1.8/net/smtp.rb:378:in `start'' /usr/lib/ruby/1.8/net/smtp.rb:316:in `start'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:436:in `perform_delivery_smtp'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:327:in `send'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:327:in `deliver!'' /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:223:in `method_missing'' /app/controllers/email_controller.rb:8:in `sent'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `perform_action_without_filters'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filters.rb:332:in `perform_action_without_benchmark'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `measure'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescue.rb:82:in `perform_action'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in `send'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:369:in `process_without_session_management_support'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/session_management.rb:116:in `process'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in `dispatch'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in `process_request'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:53:in `process!'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in `each_cgi'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in `process!'' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in `process!'' dispatch.fcgi:24 It does do this before it though Processing EmailController#sent (for 84.12.155.53 at 2006-01-24 08:50:41) [POST] So the code generating the email is fine. I would really appreciate any help!! -- Posted via http://www.ruby-forum.com/.
When I read the subject on this, I thought the body was going to be - Is still a better day than mailing in PHP/ASP/Perl. matt On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> > Hi, I''ve setup Action Mailer today to email the contents of a form. > Every seemes fine except when the email is sending. > > Here is the error I get on the production server: > > SocketError (getaddrinfo: Name or service not known): > /usr/lib/ruby/1.8/net/protocol.rb:83:in `initialize'' > /usr/lib/ruby/1.8/net/protocol.rb:83:in `new'' > /usr/lib/ruby/1.8/net/protocol.rb:83:in `connect'' > /usr/lib/ruby/1.8/net/protocol.rb:82:in `timeout'' > /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'' > /usr/lib/ruby/1.8/net/protocol.rb:82:in `connect'' > /usr/lib/ruby/1.8/net/protocol.rb:64:in `initialize'' > /usr/lib/ruby/1.8/net/smtp.rb:393:in `open'' > /usr/lib/ruby/1.8/net/smtp.rb:393:in `do_start'' > /usr/lib/ruby/1.8/net/smtp.rb:378:in `start'' > /usr/lib/ruby/1.8/net/smtp.rb:316:in `start'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:436:in > `perform_delivery_smtp'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:327:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:327:in > `deliver!'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:223:in > `method_missing'' > /app/controllers/email_controller.rb:8:in `sent'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:853:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:853:in > `perform_action_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/filters.rb:332:in > `perform_action_without_benchmark'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `measure'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:369:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:369:in > `process_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/session_management.rb:116:in > `process'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in > `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in > `process_request'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:53:in > `process!'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in > `each_cgi'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in > `process!'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in > `process!'' > dispatch.fcgi:24 > > > > > It does do this before it though Processing EmailController#sent (for > 84.12.155.53 at 2006-01-24 08:50:41) [POST] So the code generating the > email is fine. > > I would really appreciate any help!! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/193fed28/attachment-0001.html
Hi Alex ~ I have posted this before, but it might help. In this configuration the smtp server is on the same server as the app. This works in both my production and development environment. Here is an example of all the "pieces" to get actionmailer working. rails_root/config/environment.rb ~~~~~~~~~~~~~~~~~~ ActionMailer::Base.server_settings = { :address => "localhost", :port => 25, } ~~~~~~~~~~~~~~~~~~ rails_root/app/controllers/my_controller.rb ~~~~~~~~~~~~~~~~~~ def test_message_send Notifier::sendtest() end ~~~~~~~~~~~~~~~~~~ rails_root/app/models/notifier.rb ~~~~~~~~~~~~~~~~~~ class Notifier < ActionMailer::Base def sendtest() @recipients = "testto@test.com " @from = "testfrom@test.com" @subject = "Subject" @body["first_name"] = "first_test" @body["last_name"] = "last_test" end end ~~~~~~~~~~~~~~~~~~ rails_root/app/views/notifier/sendtest.rhtml ~~~~~~~~~~~~~~~~~~ Hello <%= @first_name %> <%= @last_name %>, Test Msg... ~~~~~~~~~~~~~~~~~~ On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> > Hi, I''ve setup Action Mailer today to email the contents of a form. > Every seemes fine except when the email is sending. > > Here is the error I get on the production server: > > SocketError (getaddrinfo: Name or service not known): > /usr/lib/ruby/1.8/net/protocol.rb:83:in `initialize'' > /usr/lib/ruby/1.8/net/protocol.rb:83:in `new'' > /usr/lib/ruby/1.8/net/protocol.rb:83:in `connect'' > /usr/lib/ruby/1.8/net/protocol.rb:82:in `timeout'' > /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'' > /usr/lib/ruby/1.8/net/protocol.rb:82:in `connect'' > /usr/lib/ruby/1.8/net/protocol.rb:64:in `initialize'' > /usr/lib/ruby/1.8/net/smtp.rb:393:in `open'' > /usr/lib/ruby/1.8/net/smtp.rb:393:in `do_start'' > /usr/lib/ruby/1.8/net/smtp.rb:378:in `start'' > /usr/lib/ruby/1.8/net/smtp.rb:316:in `start'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:436:in > `perform_delivery_smtp'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:327:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:327:in > `deliver!'' > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:223:in > `method_missing'' > /app/controllers/email_controller.rb:8:in `sent'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:853:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:853:in > `perform_action_without_filters'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/filters.rb:332:in > `perform_action_without_benchmark'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `measure'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/benchmarking.rb:69:in > `perform_action_without_rescue'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/rescue.rb:82:in > `perform_action'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:369:in > `send'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/base.rb:369:in > `process_without_session_management_support'' > /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2 > /lib/action_controller/session_management.rb:116:in > `process'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in > `dispatch'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:141:in > `process_request'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:53:in > `process!'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in > `each_cgi'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each'' > /usr/lib/ruby/1.8/fcgi.rb:597:in `each_cgi'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:52:in > `process!'' > /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:22:in > `process!'' > dispatch.fcgi:24 > > > > > It does do this before it though Processing EmailController#sent (for > 84.12.155.53 at 2006-01-24 08:50:41) [POST] So the code generating the > email is fine. > > I would really appreciate any help!! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/2519b8d2/attachment.html
Thanks Ben Reubenstien, I''ll give that a try now. -- Posted via http://www.ruby-forum.com/.
I cant get past this error now You have a nil object when you didn''t expect it! The error occured while evaluating nil.sendtest RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/email_controller.rb:8:in `test_message'' my controller is this class EmailController < ApplicationController def index end def test_message @mail = @params[''mail''] @name = @params[''name''] @text = @params[''text''] @Mail::sendtest(@mail, @name, @text) end end my mail.rb is this class Mail < ActionMailer::Base def sendtest(mail, name, text) @recipients = "alex.peretti@pulsedev.net" @from = "testfrom@test.com" @subject = "Subject" @body[''text''] = text @body[''name''] = name @body[''mail''] = mail end end -- Posted via http://www.ruby-forum.com/.
Hi Alex ~ I don''t think all your variables need to be @ variables... When you call your mailer object, try: mail = params[''mail''] name = params[''name''] text = params[''text''] Mail::sendtest(mail, name, text) On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> > I cant get past this error now > > You have a nil object when you didn''t expect it! > The error occured while evaluating nil.sendtest > RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/.. > Application Trace | Framework Trace | Full Trace > #{RAILS_ROOT}/app/controllers/email_controller.rb:8:in `test_message'' > > > my controller is this > class EmailController < ApplicationController > def index > end > def test_message > @mail = @params[''mail''] > @name = @params[''name''] > @text = @params[''text''] > @Mail::sendtest(@mail, @name, @text) > end > end > > my mail.rb is this > class Mail < ActionMailer::Base > def sendtest(mail, name, text) > @recipients = "alex.peretti@pulsedev.net" > @from = "testfrom@test.com" > @subject = "Subject" > > @body[''text''] = text > @body[''name''] = name > @body[''mail''] = mail > end > end > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/af61d450/attachment.html
Okay did that and now I have NoMethodError in Email#test_message undefined method `sendtest'' for Mail:Class RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/.. Application Trace | Framework Trace | Full Trace /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:225:in `method_missing'' #{RAILS_ROOT}/app/controllers/email_controller.rb:8:in `test_message'' I dont think it likes that sendtest method very much. -- Posted via http://www.ruby-forum.com/.
Alex ~ Have you restarted your app lately? I have had some instances where changes where not picked up on my mailer model... Worth a shot. ~ Ben On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> > Okay did that and now I have > > NoMethodError in Email#test_message > undefined method `sendtest'' for Mail:Class > RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/.. > Application Trace | Framework Trace | Full Trace > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5 > /lib/action_mailer/base.rb:225:in > `method_missing'' > #{RAILS_ROOT}/app/controllers/email_controller.rb:8:in `test_message'' > > I dont think it likes that sendtest method very much. > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/6489e520/attachment.html
On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> Okay did that and now I have > > NoMethodError in Email#test_message > undefined method `sendtest'' for Mail:Class > RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/.. > Application Trace | Framework Trace | Full Trace > /usr/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:225:in > `method_missing'' > #{RAILS_ROOT}/app/controllers/email_controller.rb:8:in `test_message'' > > I dont think it likes that sendtest method very much.Please include the previous messages that you are replying to. What the heck is Mail::sendtest? Try Mail::deliver_sendtest. Read http://api.rubyonrails.com/classes/ActionMailer/Base.html and brush up on your Ruby.
Ben Reubenstien wrote:> Alex ~ > > Have you restarted your app lately? I have had some instances where > changes > where not picked up on my mailer model... Worth a shot. > > ~ BenYeah I''ve been doing that alot, didn''t change anything. I''m quite dissapointed with the documentation on ActionMailer. There are no decent examples on the subject. -- Posted via http://www.ruby-forum.com/.
Joe Van Dyk wrote:> On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote: >> I dont think it likes that sendtest method very much. > Please include the previous messages that you are replying to. > > What the heck is Mail::sendtest? > > Try Mail::deliver_sendtest. > > Read http://api.rubyonrails.com/classes/ActionMailer/Base.html and > brush up on your Ruby.I''ve been working on it all day, Mail::deliver_sendtest. is what I used at the start then I was advised to change it so I did. -- Posted via http://www.ruby-forum.com/.
Joe is correct, need to update my example. You want to call the deliver method. On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> > Joe Van Dyk wrote: > > On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote: > >> I dont think it likes that sendtest method very much. > > Please include the previous messages that you are replying to. > > > > What the heck is Mail::sendtest? > > > > Try Mail::deliver_sendtest. > > > > Read http://api.rubyonrails.com/classes/ActionMailer/Base.html and > > brush up on your Ruby. > > I''ve been working on it all day, Mail::deliver_sendtest. is what I used > at the start then I was advised to change it so I did. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Ben Reubenstein http://www.benr75.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060124/d9fa9317/attachment-0001.html
Joe Van Dyk wrote:> On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote: >> I dont think it likes that sendtest method very much. > Please include the previous messages that you are replying to. > > What the heck is Mail::sendtest? > > Try Mail::deliver_sendtest. > > Read http://api.rubyonrails.com/classes/ActionMailer/Base.html and > brush up on your Ruby.I changed it back to deliver_sendtest now and it works. My problem was with the smtp server in the end it seems. Although I haven''t tested it in production yet and that''s where I had the problem. -- Posted via http://www.ruby-forum.com/.
Alexander Peretti
2006-Jan-24 18:05 UTC
[Rails] Re: Re: Re: Re: A bad day with Action Mailer
Ben Reubenstien wrote:> Joe is correct, need to update my example. You want to call the deliver > method.Thanks again guys. And for your information, you still need to use @mail = @params[''mail''] @name = @params[''name''] @text = @params[''text''] Or it doesn''t work. -- Posted via http://www.ruby-forum.com/.
On 1/24/06, Alexander Peretti <alex.peretti@pulsedev.net> wrote:> Ben Reubenstien wrote: > > Joe is correct, need to update my example. You want to call the deliver > > method. > > Thanks again guys. > > And for your information, you still need to use > @mail = @params[''mail''] > @name = @params[''name''] > @text = @params[''text'']er, I assume this is in the controller. def YourController < AC def a_method mail = params[''mail''] name = params[''name''] text = params[''text''] Mail::deliver_sendtest(mail, name, test) end end That should work fine. There''s no need to create controller instance variables.