This commit is contained in:
神楽坂 白 2023-10-30 15:43:25 +00:00
parent 11f3f27d00
commit d3689a7839

10
mian.go
View File

@ -5,7 +5,6 @@ import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"mime"
"net"
@ -13,6 +12,8 @@ import (
"os"
"time"
"io"
"github.com/jhillyerd/enmime"
"github.com/mhale/smtpd"
)
@ -67,7 +68,7 @@ func postMailContent(url string, key string, mailContent *MailContent) error {
defer resp.Body.Close()
// 读取响应体(如果需要)
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(io.Reader(resp.Body))
if err != nil {
return err
}
@ -95,6 +96,9 @@ func mailHandler(origin net.Addr, from string, to []string, data []byte) error {
// mediaType, params, err := mime.ParseMediaType(contentType)
body := env.HTML
if len(body) == 0 {
body = env.Text
}
fmt.Println("Body:", body)
@ -133,7 +137,7 @@ func main() {
}
defer file.Close()
configBytes, err := ioutil.ReadAll(file)
configBytes, err := io.ReadAll(io.Reader(file))
if err != nil {
log.Fatalf("Error reading config file: %v", err)
}