From bc234abc5bd02f3f43fd94caaa063a868cf60e24 Mon Sep 17 00:00:00 2001 From: "DESKTOP-LKF81KV\\Mak Moinee" Date: Sun, 4 Jun 2023 23:29:40 +0800 Subject: [PATCH] update repo readme --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 54fb029..f3320b0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - Stair Case (Hacker Rank Solution) - prints a staircase of size n. - Concurrency Package - useable interface for any concurrent calls. - Goserve Package - build http service to start your API with the support of injecting certs and reading config from settings.yaml +- Email - send email by using our prebuilt function, no need to code manually for email just instantiate the package and pass the required paramaters and it should work ## Installation - `go get github.com/MakMoinee/go-mith` @@ -117,3 +118,31 @@ func main() { } } ``` + + +## email package + +```go +package main + +import ( + "log" + + "github.com/MakMoinee/go-mith/pkg/email" +) + +func main() { + emailService := email.NewEmailService(587, "emailHost", "emailAddress", "emailAppPass") + + isEmailSent, err := emailService.SendEmail("receiverEmail", "emailSubject", "emailMessage") + if err != nil { + log.Fatalf("Error sending email: %s", err) + } + + if isEmailSent { + log.Println("Email Send Successfully") + } else { + log.Println("Failed to send email") + } +} +```