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
+5.2k Unix/Linux/MacOSx : How to remove an environment variable ?
+14.3k How to automatically restart your crashed Golang server
+18.4k Golang : Send email with attachment
+6.8k Golang : How to solve "too many .rsrc sections" error?
+4.6k JavaScript: Add marker function on Google Map
+11k Golang : Fix - does not implement sort.Interface (missing Len method)
+21k Golang : Convert(cast) string to rune and back to string example
+15.4k Golang : Validate hostname
+6.3k Golang : Break string into a slice of characters example
+4k Javascript : Empty an array example
+7.6k Golang : Generate human readable password
+14.9k Golang : Search folders for file recursively with wildcard support