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
+14.4k Golang : How to determine if user agent is a mobile device example
+15.1k Golang : Get HTTP protocol version example
+18.6k Golang : Iterating Elements Over A List
+15.5k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+9.7k Golang : interface - when and where to use examples
+4.6k JavaScript : Rounding number to decimal formats to display currency
+12.3k Golang : Validate email address
+11.9k Golang : How to parse plain email text and process email header?
+5.6k Swift : Get substring with rangeOfString() function example
+7.9k Golang : Grayscale Image
+9.5k Golang : Read file with ioutil
+12k Golang : Save webcamera frames to video file