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.6k Golang : Calculate diameter, circumference, area, sphere surface and volume
+12.5k Golang : 2 dimensional array example
+37.7k Upload multiple files with Go
+46.8k Golang : Marshal and unmarshal json.RawMessage struct example
+7.4k Golang : Check if one string(rune) is permutation of another string(rune)
+23.6k Golang : Check if element exist in map
+11.3k Golang : How to determine a prime number?
+9.1k Golang : Inject/embed Javascript before sending out to browser example
+16.6k Golang : Execute terminal command to remote machine example
+8.6k Golang : Generate Datamatrix barcode
+5.3k Golang : Print instead of building pyramids
+9k Golang : GMail API create and send draft with simple upload attachment example