# ActionMailer getaddrinfo: Name or service not known

**URL:** <https://www.ruby-forum.com/t/actionmailer-getaddrinfo-name-or-service-not-known/160045>\
**Category:** Rails\
**Created:** [February 11, 2009, 10:00am UTC](https://www.ruby-forum.com/t/actionmailer-getaddrinfo-name-or-service-not-known/160045 "2009-02-11T10:00:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtspimp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jtspimp](https://www.ruby-forum.com/u/jtspimp)\
**Post date:** [February 11, 2009, 10:00am UTC](https://www.ruby-forum.com/t/actionmailer-getaddrinfo-name-or-service-not-known/160045/1 "2009-02-11T10:00:10Z")

</div>

When I deploy my rails 2.2.2 app to bluehost, I’m having trouble with  
the ActionMailer SMTP settings.

When I attempt to send emails through Rails/SMTP, I get the following  
error message:

getaddrinfo: Name or service not known

google says that this means there’s an error negotiating with the mail  
server.

Here are the settings I’m using for SMTP delivery:

config.action\_mailer.smtp\_settings = {  
:domain =\> ‘[domain.com](http://domain.com)’,  
:address =\> ‘[mail.domain.com](http://mail.domain.com)’,  
:port =\> 25,  
:user\_name =\> ‘removed\_email\_address@domain.invalid’,  
:password =\> ‘passwd’,  
:authentication =\> :login  
}

I’ve attempted setting domain to localhost/127.0.0.1 as google  
prescribes, but I’m still experiencing the issue. So I did a telnet  
session with the SMTP service and I receieved a 550 status error (550  
Administrative prohibition).

After communicating with bluehost support, they reconfig’d the SMTP  
service so that all mails originating from the local network would be  
relayed and the telnet SMTP session was successful.

But my app is still failing to communicate with the SMTP service.

I turned on debug level logging and the log file tells me that the  
email is successfully generated and sent to its intended recipient,  
then it gives me the getaddrinfo: Name or service not known error  
again.

I also attempted to config the application to use sendmail, and it  
fails with exactly the same error. getaddrinfo: Name or service not  
known error.

I attempted a debug session using the production console:

Loading production environment (Rails 2.2.2)

> > UserMailer.deliver\_contact\_form ‘test’, ‘removed\_email\_address@domain.invalid’, ‘test’, ‘test’  
> > SocketError: getaddrinfo: Name or service not known  
> > from /usr/lib/ruby/1.8/net/protocol.rb:206:in `initialize' from /usr/lib/ruby/1.8/net/protocol.rb:206:in `new’  
> > from /usr/lib/ruby/1.8/net/protocol.rb:206:in `old_open' from /usr/lib/ruby/1.8/timeout.rb:62:in `timeout’  
> > from /usr/lib/ruby/1.8/timeout.rb:93:in `timeout' from /usr/lib/ruby/1.8/net/protocol.rb:206:in `old\_open’  
> > from /usr/lib/ruby/1.8/net/smtp.rb:392:in `do_start' from /usr/lib/ruby/1.8/net/smtp.rb:377:in `start’  
> > from /home/jts/ruby/gems/gems/actionmailer-2.2.2/lib/  
> > action\_mailer/base.rb:671:in `perform_delivery_smtp' from /home/jts/ruby/gems/gems/actionmailer-2.2.2/lib/ action_mailer/base.rb:526:in ` **send** ’  
> > from /home/jts/ruby/gems/gems/actionmailer-2.2.2/lib/  
> > action\_mailer/base.rb:526:in `deliver!' from /home/jts/ruby/gems/gems/actionmailer-2.2.2/lib/ action_mailer/base.rb:392:in `method\_missing’  
> > from (irb):1

I’ve been pulling my hair out over this for more than a week now! If  
anyone can offer any insight, advice, suggestion, that’d be super!

cheers,  
j
