This recipe will give you a brief description on how to use the standard library to connect to the SMTP server and send an email.
Sending a simple email
Getting ready
In this recipe, we will use a Google Gmail account to send the email message. With a few configurations, this recipe will be useful for other SMTP servers as well.
How to do it...
- Open the console and create the folder chapter07/recipe10.
- Navigate to the directory.
- Create the smtp.go file with the following content:
package main
import (
"crypto/tls"
"fmt...