gomail/README.md

93 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2014-10-15 23:47:07 +08:00
# Gomail
2015-09-02 19:41:40 +08:00
[![Build Status](https://travis-ci.org/go-gomail/gomail.svg?branch=v2)](https://travis-ci.org/go-gomail/gomail) [![Code Coverage](http://gocover.io/_badge/gopkg.in/gomail.v2)](http://gocover.io/gopkg.in/gomail.v2) [![Documentation](https://godoc.org/gopkg.in/gomail.v2?status.svg)](https://godoc.org/gopkg.in/gomail.v2)
2014-10-15 23:47:07 +08:00
## Introduction
2015-07-23 04:59:28 +08:00
Gomail is a simple and efficient package to send emails. It is well tested and
documented.
Gomail can only send emails using an SMTP server. But the API is flexible and it
is easy to implement other methods for sending emails using a local Postfix, an
API, etc.
2015-07-23 04:59:28 +08:00
It is versioned using [gopkg.in](https://gopkg.in) so I promise
2016-03-04 15:28:58 +08:00
there will never be backward incompatible changes within each version.
2014-10-15 23:47:07 +08:00
2015-09-02 19:43:08 +08:00
It requires Go 1.2 or newer. With Go 1.5, no external dependencies are used.
2014-10-15 23:47:07 +08:00
## Features
2015-07-23 04:59:28 +08:00
Gomail supports:
- Attachments
- Embedded images
- HTML and text templates
- Automatic encoding of special characters
- SSL and TLS
- Sending multiple emails with the same SMTP connection
2014-10-15 23:47:07 +08:00
## Documentation
2015-09-02 19:41:40 +08:00
https://godoc.org/gopkg.in/gomail.v2
2014-10-15 23:47:07 +08:00
## Download
2015-09-02 19:41:40 +08:00
go get gopkg.in/gomail.v2
2014-10-15 23:47:07 +08:00
2015-07-26 00:59:05 +08:00
## Examples
2014-10-15 23:47:07 +08:00
2015-09-02 19:41:40 +08:00
See the [examples in the documentation](https://godoc.org/gopkg.in/gomail.v2#example-package).
2014-10-15 23:47:07 +08:00
2014-10-22 23:47:24 +08:00
## FAQ
### x509: certificate signed by unknown authority
If you get this error it means the certificate used by the SMTP server is not
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`:
2016-03-06 00:24:14 +08:00
package main
import (
"crypto/tls"
"gopkg.in/gomail.v2"
)
func main() {
d := gomail.NewDialer("smtp.example.com", 587, "user", "123456")
2016-03-06 00:24:14 +08:00
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
// Send emails using d.
}
2014-10-22 23:47:24 +08:00
Note, however, that this is insecure and should not be used in production.
2015-07-21 05:18:34 +08:00
## Contribute
2015-07-27 00:12:39 +08:00
Contributions are more than welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for
more info.
2014-10-15 23:47:07 +08:00
2015-07-21 05:34:28 +08:00
## Change log
See [CHANGELOG.md](CHANGELOG.md).
## License
[MIT](LICENSE)
2015-07-21 05:18:34 +08:00
## Contact
You can ask questions on the [Gomail
2015-09-02 19:57:04 +08:00
thread](https://groups.google.com/d/topic/golang-nuts/jMxZHzvvEVg/discussion)
2015-07-21 05:18:34 +08:00
in the Go mailing-list.