Fixed commented examples
This commit is contained in:
parent
3346e955b2
commit
867c4d1580
13
README.md
13
README.md
|
@ -47,16 +47,12 @@ func main() {
|
||||||
msg.SetAddressHeader("Cc", "dan@example.com", "Dan")
|
msg.SetAddressHeader("Cc", "dan@example.com", "Dan")
|
||||||
msg.SetHeader("Subject", "Hello!")
|
msg.SetHeader("Subject", "Hello!")
|
||||||
msg.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!")
|
msg.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!")
|
||||||
|
msg.Attach(gomail.NewFile("/home/Alex/lolcat.jpg"))
|
||||||
|
|
||||||
f, err := gomail.OpenFile("/home/Alex/lolcat.jpg")
|
d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
msg.Attach(f)
|
|
||||||
|
|
||||||
// Send the email to Bob, Cora and Dan
|
// Send the email to Bob, Cora and Dan
|
||||||
mailer := gomail.NewMailer("smtp.example.com", "user", "123456", 587)
|
if err := d.DialAndSend(msg); err != nil {
|
||||||
if err := mailer.Send(msg); err != nil {
|
|
||||||
panic(err)
|
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
|
bypass the verification of the server's certificate chain and host name by using
|
||||||
`SetTLSConfig`:
|
`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.
|
Note, however, that this is insecure and should not be used in production.
|
||||||
|
|
||||||
|
|
|
@ -299,11 +299,7 @@ func (m *Message) Attach(f ...*File) {
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// f, err := gomail.OpenFile("/tmp/image.jpg")
|
// m.Embed(gomail.NewFile("/tmp/image.jpg"))
|
||||||
// if err != nil {
|
|
||||||
// panic(err)
|
|
||||||
// }
|
|
||||||
// m.Embed(f)
|
|
||||||
// m.SetBody("text/html", `<img src="cid:image.jpg" alt="My image" />`)
|
// m.SetBody("text/html", `<img src="cid:image.jpg" alt="My image" />`)
|
||||||
func (m *Message) Embed(image ...*File) {
|
func (m *Message) Embed(image ...*File) {
|
||||||
if m.embedded == nil {
|
if m.embedded == nil {
|
||||||
|
|
Loading…
Reference in New Issue