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
+6.7k Golang : constant 20013 overflows byte error message
+7k Golang : Calculate how many weeks left to go in a given year
+21.9k Golang : Repeat a character by multiple of x factor
+10.4k Android Studio : Checkbox for user to select options example
+31.4k Golang : Convert an image file to []byte
+24.1k Golang : GORM read from database example
+10.1k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+21.8k Golang : Securing password with salt
+17.8k Golang : Check if a directory exist or not
+16.5k Golang : Fix cannot convert buffer (type *bytes.Buffer) to type string error
+5.7k PHP : How to check if an array is empty ?
+13.9k Golang : Check if a file exist or not