RubyonRails_newbie
2009-Nov-11 20:02 UTC
getaddrinfo: nodename nor servname provided, or not known
Hi there, If I want to create email within my application (in production), how is this best achieved?? Following the railsspace tutorial, it only really suggests to use :smtp. I''d read on another site that to generate emails locally, i need to use :sendmail instead... However - I havent seen any decent examples of how to get this configured to be able to send emails within my local area. Within my email_controller I have the following code: def remind @title = "Send me my login information" if param_posted?(:user) email = params[:user][:email] user = User.find_by_email(email) if user UserMailer.deliver_reminder(user) flash[:notice] = "Login information was sent." redirect_to :action => "index", :controller => "site" else flash[:notice] = "There is no user with that email address." end end In environment.rb I have: ActionMailer::Base.delivery_method = :sendmail and at the top of the same file I have: ENV[''RAILS_ENV''] ||= ''production'' When I try and enter an email address into the form: I tget an error back: SocketError in EmailController#remind getaddrinfo: nodename nor servname provided, or not known Has anyone else experienced this, and how do you get it up and running? Many Thanks
Frederick Cheung
2009-Nov-11 22:59 UTC
Re: getaddrinfo: nodename nor servname provided, or not known
On Nov 11, 8:02 pm, RubyonRails_newbie <craigwest...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> In environment.rb I have: > ActionMailer::Base.delivery_method = :sendmail > > and at the top of the same file I have: > ENV[''RAILS_ENV''] ||= ''production'' >> When I try and enter an email address into the form: > I tget an error back: > > SocketError in EmailController#remind > getaddrinfo: nodename nor servname provided, or not knownThat sounds like it''s still trying to use smtp (but without a valid smtp server). Did you restart the app after changing this ? With sendmail you just need to tell rails where sendmail is (and even then only if sendmail isn''t where rails expects to find it). Fred> > Has anyone else experienced this, and how do you get it up and > running? > Many Thanks