README, default template repository, template example.

This commit is contained in:
Karchnu 2020-11-01 21:56:41 +01:00
parent c04544838d
commit 13aa6a2019
3 changed files with 67 additions and 1 deletions

50
README.md Normal file
View File

@ -0,0 +1,50 @@
# USAGE
As all programs from `Baguette` repositories, a `-h` option is available for the program.
```Bash
mailer -h
```
### Sending a mail
```Bash
# One-shot email transfer.
# mailer send <template> <email>
login=mypseudo token=aabbccdd mailer send activation-email test@example.com
```
### Configuration
As all programs from `Baguette` repositories, a configuration file either in the `$XDG_CONFIG_HOME/baguette/` (first guess) or in the `/etc/baguette/` directory can be used.
Here an exhaustive example:
```YAML
# ~/.config/baguette/mailer.yml
# SMTPd configuration.
smtpd_host: localhost
smtpd_port: 25
# Where to find templates, if not in the defaut directory (/etc/baguette/mailer/templates/).
template_directory: /path/to/mailer/templates
# Configuration for each template.
templates:
# Template name, associated to the mail configuration: "from" and "subject" headers.
mail-activation-fr:
from: no-reply@example.com
subject: Account activation on the example.com website
mail-recovery-fr:
from: no-reply@example.com
subject: Mail recovery for the example.com website
```
### Templates
Templates:
- are in the [Crinja format][crinja] (a Jinja derivative)
- located by default in `/etc/baguette/mailer/templates`
[crinja]: https://github.com/straight-shoota/crinja

View File

@ -23,7 +23,7 @@ class Baguette::Configuration
# template => subject
property templates : YAML::Any? = nil
property templates_directory : String = "templates/"
property templates_directory : String = "/etc/baguette/mailer/templates/"
def initialize
end

View File

@ -0,0 +1,16 @@
Hello {{ login }}!
You subscribed to the example.com website!
Please, use the following link to activate your account:
https://example.com/account-activation/{{ login }}/{{ token }}
In the case you are not {{ login }} from the example.com, you can dismiss this email.
Thanks!
--
example.com