all repos — mail2 @ 833141fcdaebe89217997a07c789ef959581b494

fork of github.com/joegrasse/mail with some changes

Change Basic Example
Joe Grasse hide@my.email
Mon, 20 Mar 2017 08:05:58 -0500
commit

833141fcdaebe89217997a07c789ef959581b494

parent

0ba4ffc5b49bab066a2c8b2b0f275d4a8ce18872

1 files changed, 3 insertions(+), 26 deletions(-)

jump to
M README.mdREADME.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") } } ```