go-zeptomail
go-zeptomail
is a Go library for sending emails using the ZeptoMail API with HTML templates.
Installation
You can install the package using go get
:
go get github.com/blessedmadukoma/go-zeptomail
Setup
Rename the .env.example
to .env
and replace the dummy data with your ZeptoMail credentails
Usage:
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: "zeptomail@mail.com",
}
// payload for the send email request
data := zeptomail.MailData{
RecipientName: "Your recepient name",
RecipientEmail: "email@mail.com",
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
if err := client.Send(data); err != nil {
fmt.Println(err)
return
}
}
Contributing
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.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to ZeptoMail for providing the email-sending service.
- This project is maintained by Blessed Madukoma.