In my GnuPG article about how to attend a PGP signing party I explained how to set up caff using SMTP (Simple Mail Transfer Protocol). However, using a local Mail Transfer Agent (MTA) is the more elegant solution as SMTP is not a properly supported option and discuraged, according to the caff man page or when setting $CONFIG{'mailer-send'}
to any value:
Warning when using $CONFIG{'mailer-send'} Setting this option is strongly discouraged. Fix your local MTA instead. |
This how-to will focus on how to send mails via Google Mail (gmail).
Installation
While I am not using Ubuntu anymore, installing caff
will also install exim4 as a MTA. This is not the case on Arch Linux or Manjaro, as it is an optional dependency.
While the German article describes how to install Postfix, for this english version I decided to use postfix on Manjaro. While dma would have been a great choice, too, it currently does not support TLSv1.2 and is thus defunct.
# Using paru on Arch/Manjaro:
paru -Syu signing-party postfix
# Using apt-get on Ubuntu and Debian:
apt-get install signing-party postfix libsasl2-modules exim4_ mailx
The configuration is done in just two files:
root: user
Then reload the changes:
sudo postalias /etc/postfix/aliases
smtp.gmail.com:587 myMail@gmail.com:clear-text-password
sudo chmod 0600 /etc/postfix/sasl_password
user gmail_user@gmail.com
sudo postmap /etc/postfix/sender_canonical
smtp_sasl_auth_enable = yes
smtp_tls_security_level = encrypt
relayhost = [smtp.gmail.com]:587
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
sender_canonical_maps = hash:/etc/postfix/sender_canonical
sudo systemctl enable postfix --now
Testing the mail relay service
Now everything should work.
mail -s "subject" my_user@gmail.com
Write some text here.
When you are done, press CTRL+d:
^D
# check the postfix logs for errors:
journalctl -ru postfix | head -n 10
In case your mail has arrived, you are done!