test email

This commit is contained in:
shoopea
2022-06-19 12:12:00 +08:00
parent 86ddd52642
commit 493715555d
3 changed files with 23 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
"encoding/base64"
"log"
"net/smtp"
"strings"
"time"
@@ -48,6 +49,10 @@ func SendMail(addr, from, subject, body string, to []string) error {
"Content-Transfer-Encoding: base64\r\n" +
"\r\n" + base64.StdEncoding.EncodeToString([]byte(body))
if *debugFlag {
log.Printf("SendMail :\r\n%s", msg)
}
_, err = w.Write([]byte(msg))
if err != nil {
return err