mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
Daniel Mason
fd615102a8
- Fixed looking up invalid profiles - Added valid error handling to bad request && rate limiting - Add Sendgrid library (Will add SMTP later) - Complete password reset process
19 lines
514 B
Go
19 lines
514 B
Go
package goscrobble
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/sendgrid/sendgrid-go"
|
|
"github.com/sendgrid/sendgrid-go/helpers/mail"
|
|
)
|
|
|
|
func sendEmail(destName string, destEmail string, subject string, content string) error {
|
|
from := mail.NewEmail(os.Getenv("MAIL_FROM_NAME"), os.Getenv("MAIL_FROM_ADDRESS"))
|
|
to := mail.NewEmail(destName, destEmail)
|
|
message := mail.NewSingleEmail(from, subject, to, content, "")
|
|
client := sendgrid.NewSendClient(os.Getenv("SENDGRID_API_KEY"))
|
|
|
|
_, err := client.Send(message)
|
|
return err
|
|
}
|