# SocketError in EmailController#correspond

**URL:** <https://www.ruby-forum.com/t/socketerror-in-emailcontroller-correspond/159766>\
**Category:** Rails\
**Created:** [February 8, 2009, 1:49pm UTC](https://www.ruby-forum.com/t/socketerror-in-emailcontroller-correspond/159766 "2009-02-08T13:49:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aoifeoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b9bd4f/32.png) [@aoifeoz](https://www.ruby-forum.com/u/aoifeoz)\
**Post date:** [February 8, 2009, 1:49pm UTC](https://www.ruby-forum.com/t/socketerror-in-emailcontroller-correspond/159766/1 "2009-02-08T13:49:32Z")

</div>

SocketError in EmailController#correspond  
getaddrinfo: no address associated with hostname.

Please see above, these are the errors i get when i try to email a user  
on my networking site. Can you help please.

Actionmailer address = smtp.vodafone.ie

Below is code used for the email controller in  
apps/controllers/email\_controller.rb There doesnt seem to be any code  
missing. Can someone help with this error, are there any possible  
solutions???

Thanks.

class EmailController \< ApplicationController  
layout “site”  
include ApplicationHelper  
include ProfileHelper  
before\_filter :protect, :only =\> [“correspond”]

def remind  
@title = “Mail 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  
end

def correspond  
user = User.find(session[:user\_id])  
recipient = User.find\_by\_user\_name(params[:id])  
@title = “Email #{recipient.name}”  
if param\_posted?(:message)  
@message = Message.new(params[:message])  
if @message.valid?  
UserMailer.deliver\_message(  
:user =\> user,  
:recipient =\> recipient,  
:message =\> @message,  
:user\_url =\> profile\_for(user),  
:reply\_url =\> url\_for(:action =\> “correspond”,  
:id =\> user.user\_name)  
)  
flash[:notice] = “Email sent.”  
redirect\_to profile\_for(recipient)  
end  
end  
end  
end

---

<div class="post-metadata">

**Author:** ![aoifeoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b9bd4f/32.png) [@aoifeoz](https://www.ruby-forum.com/u/aoifeoz)\
**Post date:** [February 8, 2009, 3:32pm UTC](https://www.ruby-forum.com/t/socketerror-in-emailcontroller-correspond/159766/2 "2009-02-08T15:32:26Z")

</div>

Aoife,

does your server have a DNS server set in the network settings so it  
can determine the ip address for that domain?

Just did an nslookup on that domain:

tretch$ nslookup smtp.vodafone.ie  
Server: 68.87.76.178  
Address: 68.87.76.178#53

Non-authoritative answer:  
\*\*\* Can’t find smtp.vodafone.ie: No answer

Sounds like it can’t be found. ping doesn’t work either.

Al

On Feb 8, 4:49 am, Aoife D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![aoifeoz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b9bd4f/32.png) [@aoifeoz](https://www.ruby-forum.com/u/aoifeoz)\
**Post date:** [February 8, 2009, 4:25pm UTC](https://www.ruby-forum.com/t/socketerror-in-emailcontroller-correspond/159766/3 "2009-02-08T16:25:36Z")

</div>

stretch wrote:

> Aoife,
> 
> does your server have a DNS server set in the network settings so it  
> can determine the ip address for that domain?
> 
> Just did an nslookup on that domain:
> 
> tretch$ nslookup smtp.vodafone.ie  
> Server: 68.87.76.178  
> Address: 68.87.76.178#53
> 
> Non-authoritative answer:  
> \*\*\* Can’t find smtp.vodafone.ie: No answer
> 
> Sounds like it can’t be found. ping doesn’t work either.
> 
> Al
> 
> On Feb 8, 4:49ï¿½am, Aoife D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Hi,

Thanks for that. Yes i didnt actually find that address anywhere i just  
assumed it was correct as it was used by another person, i found out  
previously through another forum.

I have just changed over to my eircom broadband and used the  
[smtp.eircom.net](http://smtp.eircom.net) address which i have found to be correct. But im still  
getting an error, it’s now saying it is rejecting the address but they  
are both valid email addresses. What could i be leaving out?? Im lost  
with this one!

Thanks in advance,

Aoife.

Current Error:  
Net::SMTPFatalError in EmailController#correspond  
553 sorry, syntax error or rejected address, please forward to your  
postmaster (#5.7.1)

Application Trace | Framework Trace | Full Trace  
C:/Ruby/lib/ruby/1.8/net/smtp.rb:679:in `check_response' C:/Ruby/lib/ruby/1.8/net/smtp.rb:652:in `getok’  
C:/Ruby/lib/ruby/1.8/net/smtp.rb:630:in `mailfrom' C:/Ruby/lib/ruby/1.8/net/smtp.rb:543:in `send0’  
C:/Ruby/lib/ruby/1.8/net/smtp.rb:471:in `sendmail' C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:588:in `perform\_delivery\_smtp’  
C:/Ruby/lib/ruby/1.8/net/smtp.rb:378:in `start' C:/Ruby/lib/ruby/1.8/net/smtp.rb:315:in `start’  
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action\_mailer/base.rb:586:in  
`perform_delivery_smtp' C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:469:in ` **send** ’  
C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action\_mailer/base.rb:469:in  
`deliver!' C:/Ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:352:in `method\_missing’  
app/controllers/email\_controller.rb:31:in `correspond’
