Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

smtp.gmail.com:587 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 smtp.gmail.com ; telnet smtp.gmail.com 587? –  drone.ah Jan 17 '13 at 21:27

1 Answer 1

up vote 1 down vote accepted

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

$ ping  smtp.gmail.com
64 bytes from wi-in-f108.1e100.net (173.194.67.108): icmp_seq=1 ttl=48 time=26.9 ms
64 bytes from wi-in-f108.1e100.net (173.194.67.108): icmp_seq=2 ttl=48 time=27.0 ms
^C


$ telnet smtp.gmail.com 587

Trying 173.194.67.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
220 mx.google.com 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 smtp.gmail.com 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=74.125.25.108 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 173.194.67.108 tcp 587 ACCEPT $FW 173.194.67.108 tcp 587 –  arober11 Jan 19 '13 at 7:37

Your Answer

 
discard

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.