예제 #1
0
func sendGopherMail(body string, titlePrefix string) {

	addr := "localhost:2525"
	textbody := body
	htmlbody := "<font size=\"4\"><pre>\n" + body + "\n</pre></font>\n"
	t := time.Now()
	msg := &gophermail.Message{From: "*****@*****.**",
		//ReplyTo string // optional
		To:       []string{"Me <*****@*****.**>"},
		Subject:  titlePrefix + " test-mail-subject " + t.Local().String(),
		Body:     textbody,
		HTMLBody: htmlbody,
		//    Attachments []Attachment // optional
		// Extra mail headers.
		// Headers mail.Header
	}

	err := gophermail.SendMail(addr, nil, msg)
	if err != io.EOF && err != nil {
		panic(err)
	}
}
예제 #2
0
func sendGopherMail(subject string, body string) {

	addr := "localhost:2525"
	textbody := body
	htmlbody := "<font size=\"4\"><pre>\n" + body + "\n</pre></font>\n"
	//t := time.Now()
	msg := &gophermail.Message{From: "*****@*****.**",
		//ReplyTo string // optional
		To:       []string{"Me <*****@*****.**>"},
		Subject:  subject,
		Body:     textbody,
		HTMLBody: htmlbody,
		//    Attachments []Attachment // optional
		// Extra mail headers.
		// Headers mail.Header
	}

	//fmt.Printf("SendTestMail()/sendGopherMail() about to call gophermail.SendMail().\n")
	err := gophermail.SendMail(addr, nil, msg)
	if err != io.EOF && err != nil {
		panic(err)
	}
}