diff --git a/README.md b/README.md
index 8c1f3bf..a5006b1 100644
--- a/README.md
+++ b/README.md
@@ -47,16 +47,12 @@ func main() {
msg.SetAddressHeader("Cc", "dan@example.com", "Dan")
msg.SetHeader("Subject", "Hello!")
msg.SetBody("text/html", "Hello Bob and Cora!")
+ msg.Attach(gomail.NewFile("/home/Alex/lolcat.jpg"))
- f, err := gomail.OpenFile("/home/Alex/lolcat.jpg")
- if err != nil {
- panic(err)
- }
- msg.Attach(f)
+ d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
// Send the email to Bob, Cora and Dan
- mailer := gomail.NewMailer("smtp.example.com", "user", "123456", 587)
- if err := mailer.Send(msg); err != nil {
+ if err := d.DialAndSend(msg); err != nil {
panic(err)
}
}
@@ -72,7 +68,8 @@ considered valid by the client running Gomail. As a quick workaround you can
bypass the verification of the server's certificate chain and host name by using
`SetTLSConfig`:
- mailer := gomail.NewMailer("smtp.example.com", "user", "123456", 587, gomail.SetTLSConfig(&tls.Config{InsecureSkipVerify: true}))
+ d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
+ d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
Note, however, that this is insecure and should not be used in production.
diff --git a/message.go b/message.go
index dd50d85..9929400 100644
--- a/message.go
+++ b/message.go
@@ -299,11 +299,7 @@ func (m *Message) Attach(f ...*File) {
//
// Example:
//
-// f, err := gomail.OpenFile("/tmp/image.jpg")
-// if err != nil {
-// panic(err)
-// }
-// m.Embed(f)
+// m.Embed(gomail.NewFile("/tmp/image.jpg"))
// m.SetBody("text/html", ``)
func (m *Message) Embed(image ...*File) {
if m.embedded == nil {