getaddrinfo: nodename nor servname provided, or not known

已查看 498 次
跳至第一个未读帖子

RubyonRails_newbie

未读,
2009年11月11日 15:02:082009/11/11
收件人 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

未读,
2009年11月11日 17:59:352009/11/11
收件人 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
回复全部
回复作者
转发
0 个新帖子