You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
461 B
16 lines
461 B
package main |
|
|
|
import ( |
|
"fmt" |
|
"net/smtp" |
|
"os" |
|
) |
|
|
|
func email(id, text string) error { |
|
smtpServer := os.Getenv("SMTP_SERVER") |
|
auth := smtp.PlainAuth("", os.Getenv("SMTP_USER"), os.Getenv("SMTP_PASSWORD"), smtpServer) |
|
to := []string{os.Getenv("NOTEHUB_ADMIN_EMAIL")} |
|
msg := []byte("Subject: note reported\r\n\r\n" + |
|
fmt.Sprintf("Note https://notehub.org/%s was reported: %q\r\n", id, text)) |
|
return smtp.SendMail(smtpServer+":587", auth, to[0], to, msg) |
|
}
|
|
|