Golang : dial tcp: too many colons in address
Encounter this error message Golang : dial tcp: too many colons in address ssl://smtp.googlemail.com:465
while working on the transaction email portion today.
After some debugging, found out that Go doesn't like anything more than 1 colon in a string for hostname and password
To fix the problem, just close the string with brackets.
from
smtpHost := "ssl://smtp.googlemail.com"
to
smtpHost := "[ssl://smtp.googlemail.com]"
Basically, when dealing with hostname, password, and dial function. The rule of thumb is
[user:pass@hostname]:portnum
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+6.9k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+45.2k Golang : Use wildcard patterns with filepath.Glob() example
+10.7k Golang : ISO8601 Duration Parser example
+5.9k Javascript : How to replace HTML inside <div>?
+13.7k Golang : reCAPTCHA example
+10.1k Golang : Get escape characters \u form from unicode characters
+16.6k Golang : Get IP addresses of a domain name
+14.7k Golang : Convert(cast) int to float example
+9.6k Golang : Accessing content anonymously with Tor
+34.1k Golang : Proper way to set function argument default value
+14.7k How to automatically restart your crashed Golang server
+7.9k Golang : Example of how to detect which type of script a word belongs to