I'm trying to send email from a server. Testing on my local machine works fine but on my production Ubuntu server, the webserver fails when trying to send email.
I'm using GMail as my SMTP provider and it appears that the problem is that the production server does not allow access to the Google SMTP server.
The following command established a successful connection on my own machine but fails on the server:
$ openssl s_client -crlf -connect smtp.gmail.com:465 connect: Connection refused connect:errno=111 I've tried various combinations of iptables in case the ports where closed. I've also tried disabling the firewall with ufw disable. Neither has yielded any success for me.
Update:
telnet smtp.gmail.com 465 outputs:
Trying 74.125.143.108... Trying 74.125.143.109... Trying 2a00:1450:4010:c04::6c... telnet: Unable to connect to remote host: Network is unreachable openssl s_client -starttls smtp -crlf -connect smtp.gmail.com:465 gives me:
connect: Connection refused connect:errno=111 Furthermore iptables-save outputs:
# Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014 *mangle :PREROUTING ACCEPT [16698:11267219] :INPUT ACCEPT [16698:11267219] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [13015:16282858] :POSTROUTING ACCEPT [13015:16282858] COMMIT # Completed on Thu Aug 21 13:06:19 2014 # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014 *nat :PREROUTING ACCEPT [1421:163021] :INPUT ACCEPT [678:92411] :OUTPUT ACCEPT [1339:83461] :POSTROUTING ACCEPT [1339:83461] COMMIT # Completed on Thu Aug 21 13:06:19 2014 # Generated by iptables-save v1.4.12 on Thu Aug 21 13:06:19 2014 *filter :INPUT ACCEPT [9933:3116585] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [12536:16243622] -A INPUT -i lo -j ACCEPT COMMIT # Completed on Thu Aug 21 13:06:19 2014
openssl: openssl.org/docs/apps/s_client.html, and report back your findings.smtp.googlemail.com:465and it works. Try it.