Problems seding mail with smtp

1,811 views
Skip to first unread message

SGen

unread,
May 22, 2014, 11:35:16 PM5/22/14
to golan...@googlegroups.com
Hello, Im trying out the smtp package by trying to send myself some email. However I keep getting connection timeouts: "dial tcp 74.125.193.108:25: connection timed out".

Ive tried a number of solutions but to no avail:

From the wiki:

http://play.golang.org/p/Pa8i57g-6d

From go-nuts:

http://play.golang.org/p/GecRuxpHsV

Using https://github.com/ungerik/go-mail/:

http://play.golang.org/p/RG0hja3LTw

I also have a few questions regarding smtp.Auth:

What values do I use to authenticate mail from my own domain? Do I need to use my google account or is there some other way?

Thanks,
SGen

Nate Finch

unread,
May 23, 2014, 4:22:05 PM5/23/14
to golan...@googlegroups.com

bga...@golang.org

unread,
May 24, 2014, 7:24:54 AM5/24/14
to golan...@googlegroups.com


On Thursday, May 22, 2014 11:35:16 PM UTC-4, SGen wrote:

Gyepi SAM

unread,
May 24, 2014, 9:44:56 AM5/24/14
to Nate Finch, golan...@googlegroups.com
On Fri, May 23, 2014 at 01:22:05PM -0700, Nate Finch wrote:
> Google doesn't use port 25 for SMTP:
>
> https://www.digitalocean.com/community/articles/how-to-use-google-s-smtp-server

The document is wrong. Google does use port 25. They must, in order to receive
incoming mail for their "customers".

The document should have stated that Google does not use port 25 for outgoing mail.
The restriction is enforced during the SMTP conversation.

-Gyepi

Matt Harden

unread,
May 24, 2014, 5:47:00 PM5/24/14
to bga...@golang.org, golang-nuts
Based on those links, 465 can be used from Go just fine as long as you create the connection yourself using tls.Dial() and pass the connection to smtp.NewClient(). I don't think it would be correct for the smtp package to automatically assume port 465 is SSL, since that port is not officially assigned for smtps at all http://www.imc.org/ietf-apps-tls/mail-archive/msg00204.html.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam Genest

unread,
May 24, 2014, 6:15:04 PM5/24/14
to Nate Finch, golan...@googlegroups.com
The solution you obtained from the wiki works, but use port 587 instead of port 465.
http://stackoverflow.com/questions/15796530/what-is-the-difference-between-ports-465-and-587

Port 587 is for mail submission, Im not trying to submit mail via my gmail account 
This does seem to be the case, unless gmail is using STARTTLS on 465.

The document is wrong. Google does use port 25. They must, in order to receive
incoming mail for their "customers".

This should be the case however attempting to send to smtp.gmail.com:25 times out: "dial tcp 74.125.142.109:25: connection timed out"

Im still not sure whats going on.

Gyepi SAM

unread,
May 25, 2014, 3:21:15 AM5/25/14
to Sam Genest, golan...@googlegroups.com
On Sat, May 24, 2014 at 06:14:50PM -0400, Sam Genest wrote:
> This should be the case however attempting to send to
> smtp.gmail.com:25times out: "dial tcp
> 74.125.142.109:25: connection timed out"
>
> Im still not sure whats going on.

What happens when you run one of the following commands on the same machine
as the failing program?

% telnet 74.125.142.109 25
% socat - TCP:74.125.142.109:25

If you get an SMTP greeting then the error is on the Go side.

Most likely, the commands will also time out, implying that connections to 25
are being filtered, probably by your ISP. You can confirm by trying to connect
to SMTP servers on other networks.

-Gyepi

Sam Genest

unread,
May 25, 2014, 5:29:47 PM5/25/14
to golan...@googlegroups.com

Both telnet and socat resulted in timeout errors. The issues on my end (probably my is but no worries they'll be gone soon enough). Thanks for the help!

Reply all
Reply to author
Forward
0 new messages