Skip to content

Latest commit

 

History

History
42 lines (35 loc) · 1.18 KB

File metadata and controls

42 lines (35 loc) · 1.18 KB

Test Issues Lint codecov

email-client

The email-client Implement send email based on gmail protocol

Usage

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: "your-email@gmail.com",
    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{"receiver@gmail.com"},
}

if err := services.Send(msg); err !=nil{
    fmt.Printf("error: %v", err)
}