The email-client Implement send email based on gmail protocol
Run the following command to install the package
go get github.com/iradukunda1/email-client@latest
type config struct{
Host: "smtp.gmail.com",
Port: "587",
Sender: "[email protected]",
Secret: "******************" // your gmail password,
}
// descructuring our config you dont pass it directly
configs := email.Config{
Host: config.Host,
Port: config.Port,
Sender: config.Sender,
Secret: config.Secret,
}
services := email.New(configs)
msg := email.Email{
Subject: "Testing",
Body: fmt.Sprintf("This is a test email \n Again test email"),
Recipients: []string{"[email protected]"},
}
if err := services.Send(msg); err !=nil{
fmt.Printf("error: %v", err)
}