https://github.com/hyperboloide/qmail
A mailer that reads from a RabbitMQ queue and generates messages from Markdown templates.
https://github.com/hyperboloide/qmail
Last synced: 5 months ago
JSON representation
A mailer that reads from a RabbitMQ queue and generates messages from Markdown templates.
- Host: GitHub
- URL: https://github.com/hyperboloide/qmail
- Owner: hyperboloide
- License: mit
- Created: 2016-04-10T21:17:26.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-27T21:19:58.000Z (about 10 years ago)
- Last Synced: 2024-06-20T13:38:52.434Z (almost 2 years ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qmail
[](https://travis-ci.org/hyperboloide/qmail)
[](https://godoc.org/github.com/hyperboloide/qmail)
A mailer that reads from a RabbitMQ queue and generates messages from Markdown templates.
This project has a client and a server.
## Client
To send email you need to create and instance of the `client.Mailer`.
Start by importing the client package:
```
import "github.com/hyperboloide/qmail/client"
```
Then connect to the queue and send an email:
```
mailer, err := client.New("mails", "amqp://guest:guest@rabbitmq:5672/")
if err != nil {
log.Fatal(err)
}
email := client.Mail{
Dests: []string{"dest@example.com"},
Subject: "test",
Template: "example_template",
Data: map[string]string{"User": "test user"},
Files: []string{"/myfiles/some_file.txt"},
}
if err := mailer.Send(email); err != nil {
log.Fatal(err)
}
```
## Server
The server is available as a Docker container
```
docker pull hyperboloide/qmail
```
All configuration options are passed as environment variables:
```
docker run \
-v ~/templates:/templates \
-v ~/myfiles:/myfiles \
-link rabbitmq:rabbitmq \
-e TEMPLATES=/templates/*.md \
-e QUEUE_NAME=mails \
-e QUEUE_HOST=amqp://guest:guest@rabbitmq:5672/ \
-e SMTP_HOST=smtp.example.com \
-e SMTP_PORT=465 \
-e SMTP_USER=user@example.com \
-e SMTP_PASSWORD=password \
-e SENDER="Example User " \
hyperboloide/qmail
```
Note that if you want to send files you need to mount them in a Docker
volume (here the volume `myfiles`).