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
+10.9k Golang : Get currencies exchange rates example
+10.8k Golang : Create matrix with Gonum Matrix package example
+8.5k Golang : Find relative luminance or color brightness
+5.5k Python : Delay with time.sleep() function example
+11.5k Golang : Intercept and process UNIX signals example
+5.6k Gogland : Datasource explorer
+14.1k Golang : concatenate(combine) strings
+8.1k Golang Hello World Example
+10.3k Golang : Print how to use flag for your application example
+15k Golang : Find commonalities in two slices or arrays example
+9.7k Javascript : Read/parse JSON data from HTTP response
+14.2k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example