xfrocks/docker-xenforo

Cannot send email with SMTP server

Closed this issue · 5 comments

Swift_TransportException: Email to abc@xyz.gh failed: Connection could not be established with host smtp.mailgun.org [Connection timed out #110] src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:268

Probably an issue with the Docker networking stack. Which version of Docker are you using? Also, what is the command that was used to start the container? Have you tried pinging smtp.mailgun.org from within the container?

I use Docker version 17.09.0-ce, build afdb6d4. I can ping to google.com and mailgun.org

$ docker exec -it 1d6a485eb350 bash

$ ping google.com
PING google.com (74.125.24.102): 56 data bytes
64 bytes from 74.125.24.102: icmp_seq=0 ttl=47 time=1.365 ms
64 bytes from 74.125.24.102: icmp_seq=1 ttl=47 time=1.341 ms
64 bytes from 74.125.24.102: icmp_seq=2 ttl=47 time=1.250 ms
64 bytes from 74.125.24.102: icmp_seq=3 ttl=47 time=1.173 ms

$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.com.sg/?gfe_rd=cr&amp;dcr=0&amp;ei=z7ARWo6cCtiFrAG0qrqgCg">here</A>.
</BODY></HTML>

$ ping smtp.mailgun.org
PING smtp.mailgun.org (34.232.180.42) 56(84) bytes of data.
^C
--- smtp.mailgun.org ping statistics ---
40 packets transmitted, 0 received, 100% packet loss, time 39311ms

I found out which problem is. Digitalocean blocked SMTP outbound.
https://meta.discourse.org/t/digital-ocean-is-blocking-outgoing-mail/66740/25

@toanalien I believe Mailgun has a few other ports to use. It should be enough to get around DO blockage.

@daohoangson Thank you for your information. DO doesn't block port 2525.

Mailgun provides it as an alternate port, which mirrors port 587, in the event the above ports are blocked. This port also supports TLS encryption.

http://blog.mailgun.com/25-465-587-what-port-should-i-use/