Add activate account email notification
alex wennerberg alex@alexwennerberg.com
Sat, 12 Dec 2020 11:58:29 -0800
1 files changed,
20 insertions(+),
0 deletions(-)
jump to
A
mail.go
@@ -0,0 +1,20 @@
+package main + +import ( + "log" + "net/smtp" +) + +func SendEmail(email string, subject string, body string) { + auth := smtp.PlainAuth("", c.SMTPUsername, c.SMTPPassword, "smtp.migadu.com") + msg := "From: " + c.SMTPUsername + "\n" + + "To: " + email + "\n" + + "Cc: " + c.SMTPUsername + "\n" + + "Subject:" + subject + "\n" + + body + err := smtp.SendMail(c.SMTPServer, auth, c.SMTPUsername, []string{email}, []byte(msg)) + if err != nil { + // doesnt need to block anything i think + log.Println(err) + } +}