exceptionz

Thoughts on Technology, Methodology and Programming.

Archive for December 23rd, 2007

ActionMailer – SocketError (getaddrinfo: Name or service not known) blues

Posted by Marcus Wyatt on 23 December 2007

I launched a new website a week ago and had issues with the action mailer setup used by restful_authentication. For some reason I was receiving the socket error and google wasn’t to helpful either.

So what was the problem?

Well, first I thought it was my setup of Postfix. But it turned out to be my settings for my action mailer. Anyways, the address should not point to your complete domain name, but rather to localhost. Here is the code snippet:

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost", # instead of "smtp.yourdomain.com",
:port => 25,
:domain => "yourdomain.com",
:authentication => :login,
:user_name => "user_name",
:password => "password"
}

Of course the ActionMailer settings should go into your environment.rb file (pre 2.0)

It is just very annoying that none of the docs or tutorials point this out….

Posted in Rails | 7 Comments »