This is a generic mailer. It can be used to send emails via a template. In a near future, it will be able to be a daemon so we can request it through libipc.
Go to file
Philippe Pittoli a3e8e4c484 Grooming. 2023-02-04 03:46:38 +01:00
src Grooming. 2023-02-04 03:46:38 +01:00
templates README, default template repository, template example. 2020-11-01 21:56:41 +01:00
.gitignore Initial commit for the generic mailer. 2020-11-01 16:28:02 +01:00 README: add some explanations. 2023-02-04 03:44:32 +01:00
shard.yml Fix dependency. 2023-02-03 07:25:27 +01:00


mailer is an application to send templated emails. Templates are in the Crinja format (a Jinja derivative).

# Get some help.
mailer -h

Sending a mail

# One-shot email transfer. "login" and "token" are template parameters.
# mailer send <template> <email> \
	SUBJECT="Activate your email" \
	login=mypseudo \
	token=aabbccdd \
	mailer send activation-email

By default, configuration is:

  • smtp deamon host is '', port 25
  • template directory is /etc/mailer/templates/
  • FROM and SUBJECT (mail object) are retrieved from environment variables

So, in the previous example, without any configuration, the template activation-email refers to the file /etc/mailer/templates/activation-email.j2 (the j2 extension is for Jinja).

The /etc/mailer/templates/activation-email.j2 template could look like this:

Hello and welcome to!

To activate your account, please follow the link bellow:{{ login }}/{{ token }}

Thanks for trusting us!
Have a good day,
Staff of


As most programs from Baguette repositories, a configuration file can be used. The configuration file should be either in $XDG_CONFIG_HOME/baguette/ (first guess) or in /etc/baguette/.

In mailer, this file is used to configure:

  • how to contact the smtp deamon (host and port)
  • what directory should be used for templates
  • FROM and SUBJECT email fields

An exhaustive example:

# ~/.config/baguette/mailer.yml

# SMTPd configuration.
smtpd_host: localhost
smtpd_port: 25

# Where to find templates, if not in the defaut directory (/etc/mailer/templates/).
templates_directory: /etc/mailer/templates

# Configuration for each template.
    # Template name, associated to the mail configuration: "from" and "subject" headers.
    # Template names match the template file name in the template directory.
    # In this example, the following template file is:
    # /etc/mailer/templates/
        subject: Account activation on the website
        subject: Mail recovery for the website