Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using sendEmail to send emails using google account .. it is working fine on number of identical servers but on one if the servers it gives me the following error failed: IO::Socket::INET: connect: Connection refused

i also tried ssmtp but i also received a similar socket error

any ideas?

share|improve this question
Sounds like a networking issue... Are you able to ping and telnet to the server i.e. ping ; telnet 587? – drone.ah Jan 17 '13 at 21:27
up vote 1 down vote accepted

Have you tested you can reach the server from the box e.g.

$ ping
64 bytes from ( icmp_seq=1 ttl=48 time=26.9 ms
64 bytes from ( icmp_seq=2 ttl=48 time=27.0 ms

$ telnet 587

Connected to
Escape character is '^]'.
220 ESMTP hg17sm2838358wib.1 - gsmtp
telnet> quit

Press CTRL+] and type quit to exit.

If not check you local firewall.

share|improve this answer
I'm able to ping but the connection is refused when i telnet .... i have another server in the same location that i can communicate normally so i guess the problem is related to this specific server socket – BluesRhythm Jan 18 '13 at 15:06
What do you get from a: sudo "iptables -L -n" – arober11 Jan 18 '13 at 15:15
Also read the following two questions 1, 2 – arober11 Jan 18 '13 at 15:25
Actually this is a firewall with shorewall installed, what i reached now is shorewall is rejecting the connection from the server to the and here is the log ... however how can i modify this and configure shorewall to accept? Shorewall:fw2net:REJECT:IN= OUT=eth0 SRC=X.X.X.X DST= LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=43820 DF PROTO=TCP SPT=58025 DPT=587 WINDOW=5840 RES=0x00 SYN URGP=0 – BluesRhythm Jan 18 '13 at 17:54
By adding a series of accept rules to the /etc/shorewall/ config e.g. ACCEPT loc tcp 587 ACCEPT $FW tcp 587 – arober11 Jan 19 '13 at 7:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.