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
+5.2k Javascript : Shuffle or randomize array example
+7.7k Golang : Load DSA public key from file example
+19.9k Golang : Reset or rewind io.Reader or io.Writer
+17.6k Golang : Read data from config file and assign to variables
+32.2k Golang : Copy directory - including sub-directories and files
+8.5k Golang : Convert(cast) []byte to io.Reader type
+25.3k Golang : convert rune to integer value
+8k How to show different content from website server when AdBlock is detected?
+8.9k Golang : Handle sub domain with Gin
+17.5k Golang : Parse date string and convert to dd-mm-yyyy format
+9.6k Golang : List available AWS regions