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
+8.1k Golang : Implementing class(object-oriented programming style)
+8.2k Golang : Add text to image and get OpenCV's X, Y co-ordinates example
+9.6k Golang : Check if user agent is a robot or crawler example
+12k Golang : Validate email address
+8.6k Golang : GMail API create and send draft with simple upload attachment example
+7k Golang : Not able to grep log.Println() output
+35.4k Golang : Get file last modified date and time
+10.8k Golang : Web routing/multiplex example
+5k Golang : The Tao of importing package
+9k Golang : Generate random Chinese, Japanese, Korean and other runes
+17.3k Golang : Upload/Receive file progress indicator
+6.3k Unix/Linux : How to get own IP address ?