A mailer that reads from a queue and generates messages from templates
1.6K
A mailer that reads from a RabbitMQ queue and generates messages from Markdown templates.
This project has a client and a server.
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(
os.Getenv("QUEUE_NAME"),
os.Getenv("QUEUE_HOST"))
if err != nil {
log.Fatal(err)
}
email := client.Mail{
Dests: []string{"[email protected]"},
Subject: "test",
Template: "example_template",
Data: map[string]string{"User": "test user"},
Files: []string{"./some_file.txt"},
}
if err := mailer.Send(email); err != nil {
log.Fatal(err)
}
The server is available as a Docker container
docker pull hyperboloide/qmail
All configuration options are passed as environement variables:
docker run \
-v ~/templates:/templates \
-link rabbitmq:rabbitmq \
-e TEMPLATES=/templates/*.md \
-e QUEUE_NAME=mails \
-e QUEUE_HOST=rabbitmq \
-e SMTP_HOST=smtp.example.com \
-e SMTP_PORT=465 \
-e [email protected] \
-e SMTP_PASSWORD=password \
-e SENDER="Example User <[email protected]>" \
hyperboloide/qmail
Content type
Image
Digest
Size
5.9 MB
Last updated
over 10 years ago
docker pull hyperboloide/qmail