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.5k Golang : Change date format to yyyy-mm-dd
+13.2k Golang : How to calculate the distance between two coordinates using Haversine formula
+9.2k Golang : Generate Codabar
+9.4k Golang : Timeout example
+8k Swift : Convert (cast) String to Float
+11.7k Golang : Find age or leap age from date of birth example
+12.1k Golang : Perform sanity checks on filename example
+5k Python : Convert(cast) bytes to string example
+8.9k Android Studio : Image button and button example
+30.5k Golang : Generate random string
+19.1k Golang : Clearing slice
+5.3k Golang : Get FX sentiment from website example