Change Basic Example
Joe Grasse hide@my.email
Mon, 20 Mar 2017 08:05:58 -0500
1 files changed,
3 insertions(+),
26 deletions(-)
jump to
M
README.md
→
README.md
@@ -13,40 +13,17 @@ package main
import ( "fmt" + "github.com/joegrasse/mail" ) func main() { - var err error - email := mail.New() - - email.SetFrom("From Example <from@example.com>") - email.AddTo("to@example.com") - email.SetSubject("New Go Email") + err := mail.New().SetFrom("From Example <from@example.com>").AddTo("to@example.com").SetSubject("New Go Email").SetBody("text/plain", "Hello Gophers!").Send("smtp.example.com:25") - email.SetBody("text/plain", "Hello Gophers!") - - html_body := - `<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Html Email Test!</title> - </head> - <body> - <p>Hello <b>Gophers</b>!</p> - <p><img src="cid:image.jpg" alt="image" /></p> - </body> - </html>` - email.AddAlternative("text/html", html_body) - - email.AddInline("/path/to/image.jpg") - - err = email.Send("smtp.example.com:25") - if err != nil { fmt.Println(err) } else { - fmt.Println("Email Sent!") + fmt.Println("Email Sent") } } ```