go-zeptomail
is a Go library for sending emails using the ZeptoMail API with HTML templates.
You can install the package using go get
:
go get github.com/blessedmadukoma/go-zeptomail
Rename the .env.example
to .env
and replace the dummy data with your ZeptoMail credentails
package main
import (
"fmt"
zeptomail "github.com/blessedmadukoma/go-zeptomail"
)
func main() {
// smtp uses the ZeptoMail configurations provided in your dashboard. Store in .env file
smtp := zeptomail.SMTP{
Host: "smtp.zeptomail.com",
Port: 465,
Username: "zeptomailusername",
Password: "zeptomailpassword",
SenderEmail: "[email protected]",
}
// payload for the send email request
data := zeptomail.MailData{
RecipientName: "Your recepient name",
RecipientEmail: "[email protected]",
TemplateFile: "welcome.html",
}
// creates a new zeptomail instance
client := zeptomail.New(smtp)
// sends the email to the recipient's email address and check for error if any
response, err := client.Send(data);
if err != nil {
fmt.Println(err)
return
}
// print the response
log.Println(response)
}
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and test them thoroughly.
- Commit your changes with clear commit messages.
- Push your changes to your fork.
- Create a pull request to the main repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to ZeptoMail for providing the email-sending service.
- This project is maintained by Blessed Madukoma.