import (
"net/smtp"
"github.com/quixote-liu/email"
)
func main() {
e := email.Email{
From: "[email protected]",
To: []string{"[email protected]"},
Subject: "This is Subject",
Addr: "smtp.example.com:25",
}
if err := e.AttachFile("./filename.txt"); err != nil {
log.Fatal(err)
}
auth := smtp.PlainAuth("", "[email protected]", "your_password", "smtp.example.com")
message := []byte("hello, world")
err := e.SetAuth(auth).WriteText(message).Send()
if err != nil {
log.Fatal(err)
}
// reset email message, include attchments.
e.Reset()
}
-
Notifications
You must be signed in to change notification settings - Fork 0
email client tool
License
quixote-liu/email
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|