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
+11.8k Golang : Convert IPv4 address to packed 32-bit binary format
+5k Golang : Generate multiplication table from an integer example
+9.9k Android Studio : Create custom icons for your application example
+6.4k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+13.6k Golang : Search folders for file recursively with wildcard support
+6k Golang : How to detect if a sentence ends with a punctuation?
+9.1k Golang : Convert file content to Hex
+4.7k Golang : Grab news article text and use NLP to get each paragraph's sentences
+6.4k Golang : Not able to grep log.Println() output
+3.8k Nginx and PageSpeed build from source CentOS example
+8.4k Golang : Launch Mac OS X Preview (or other OS) application from your program example
+8.6k Golang : Validate IPv6 example