-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX][#4] Send email forgot password using sendgrid
- Loading branch information
Showing
6 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package email | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/sendgrid/sendgrid-go" | ||
"github.com/sendgrid/sendgrid-go/helpers/mail" | ||
) | ||
|
||
// SendMailV3 for send mail from sendgrid | ||
func SendMailV3(from *mail.Email, p *mail.Personalization, templateID string) error { | ||
m := mail.NewV3Mail() | ||
m.SetFrom(from) | ||
m.SetTemplateID(templateID) | ||
m.AddPersonalizations(p) | ||
|
||
request := sendgrid.GetRequest(os.Getenv("SENDGRID_API_KEY"), "/v3/mail/send", "https://api.sendgrid.com") | ||
request.Method = "POST" | ||
request.Body = mail.GetRequestBody(m) | ||
_, err := sendgrid.API(request) | ||
|
||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters