go-mail
creates a simple wrapper around [net/mail.Message] to extend common
functionality.
$ go get -u github.com/codykaup/go-mail
import (
"bufio"
"fmt"
"os"
mail "github.com/codykaup/go-mail"
)
func main() {
reader := bufio.NewReader(os.Stdin)
message, _ := mail.ReadMessage(reader)
fmt.Printf("Headers: %+v\n", message.Header)
fmt.Printf("Body: %+v\n", message.Body)
}
import (
"bufio"
"fmt"
"os"
mail "github.com/codykaup/go-mail"
)
func main() {
reader := bufio.NewReader(os.Stdin)
message, _ := mail.ReadMessage(reader)
fmt.Printf("Headers: %+v\n", message.Header)
entry, _ := mail.NewHeaderEntry("Cc", "[email protected]")
message.AppendHeader(entry)
fmt.Printf("New Headers: %+v\n", message.Header)
}
import (
"bufio"
"fmt"
"os"
mail "github.com/codykaup/go-mail"
)
func main() {
reader := bufio.NewReader(os.Stdin)
message, _ := mail.ReadMessage(reader)
fmt.Println(message.Join())
}