Skip to content

iradukunda1/email-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: "[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)
}