diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-09 18:09:36 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-09 18:09:36 -0800 |
commit | e70c231df82f4e5f09869f8d570d809a5f70993c (patch) | |
tree | e1a0c76ab0483c29b78ba7c0458f5f59b5ca0598 /cmd/ponzu/vendor/github.com/nilslice/email/README.md | |
parent | ea3d29602be45c49629c2a8b6b8199e4f9e9076d (diff) |
adding initial partial implementation of account recovery flow
Diffstat (limited to 'cmd/ponzu/vendor/github.com/nilslice/email/README.md')
-rw-r--r-- | cmd/ponzu/vendor/github.com/nilslice/email/README.md | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/cmd/ponzu/vendor/github.com/nilslice/email/README.md b/cmd/ponzu/vendor/github.com/nilslice/email/README.md new file mode 100644 index 0000000..323004c --- /dev/null +++ b/cmd/ponzu/vendor/github.com/nilslice/email/README.md @@ -0,0 +1,51 @@ +## Email + +I needed a way to send email from a [Ponzu](https://ponzu-cms.org) installation +running on all kinds of systems without shelling out. `sendmail` or `postfix` et +al are not standard on all systems, and I didn't want to force users to add API +keys from a third-party just to send something like an account recovery email. + +### Usage: +`$ go get github.com/nilslice/email` + +```go +package main + +import ( + "fmt" + "github.com/nilslice/email" +) + +func main() { + msg := email.Message{ + To: "you@server.name", // do not add < > or name in quotes + From: "Name <me@server.name>", // ok to format in From field + Subject: "A simple email", + Body: "Plain text email body. HTML not yet supported, but send a PR!", + } + + err := msg.Send() + if err != nil { + fmt.Println(err) + } +} + +``` + +### Under the hood +`email` looks at a `Message`'s `To` field, splits the string on the @ symbol and +issues an MX lookup to find the mail exchange server(s). Then it iterates over +all the possibilities in combination with commonly used SMTP ports for non-SSL +clients: `25, 2525, & 587` + +It stops once it has an active client connected to a mail server and sends the +initial information, the message, and then closes the connection. + +Currently, this doesn't support any additional headers or `To` field formatting +(the recipient's email must be the only string `To` takes). Although these would +be fairly strightforward to implement, I don't need them yet.. so feel free to +contribute anything you find useful. + +#### Warning +Be cautious of how often you run this locally or in testing, as it's quite +likely your IP will be blocked/blacklisted if it is not already.
\ No newline at end of file |