getaddrinfo: nodename nor servname provided, or not known

498 views
Skip to first unread message

RubyonRails_newbie

unread,
Nov 11, 2009, 3:02:08 PM11/11/09
to Ruby on Rails: Talk
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

unread,
Nov 11, 2009, 5:59:35 PM11/11/09
to Ruby on Rails: Talk


On Nov 11, 8:02 pm, RubyonRails_newbie <craigwest...@googlemail.com>
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 known

That 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
Reply all
Reply to author
Forward
0 new messages