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
+9.3k Golang : Meaning of omitempty in struct's field tag
+20.1k Golang : Convert(cast) string to rune and back to string example
+23.1k Golang : Time slice or date sort and reverse sort example
+10.1k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+32.9k Golang : Integer is between a range
+11.4k Golang : HTTP response JSON encoded data
+16.2k Golang : How to remove certain lines from a file
+20.5k Golang : Match strings by wildcard patterns with filepath.Match() function
+5.7k Golang : Find the shortest line of text example
+18.3k Golang : How to Set or Add Header http.ResponseWriter?
+10.8k Golang : Simple client-server HMAC authentication without SSL example
+8.3k Golang : How to get ECDSA curve and parameters data?