TABLE OF CONTENT
Introduction
The focus of this guide is not a classic email client configuration on a desktop environment, such as Thunderbird. Here, I will show you how to configure an "email relay" on your server system, making it capable of sending emails. This way, your server can send automatic emails to you once a significant event occurs.
For example, if you are running a backup, and once the backup is complete, you can "instruct" your server to email you whether that backup was successful or not. As another example, you can configure "monitoring" of your file system, and the server can send you an email when it's running low on disk space (or inodes). There are many other usage scenarios, and you can consider this a first step in alerting. In other words, your server telling you, "I have a problem, and I need help".
Prerequisites
apt install dma
You will need a Gmail account for this, so please create one if you don't have it already. If you have an existing account or you are opening a new Gmail account, make sure you enable 2-Step Verification.
Also, DragonFly "supports" local aliases controlled by /etc/aliases file. This can be useful in server environments where root user may sometimes receive messages from services running on the server. You can use your Gmail email as an alias for root user so that all such emails will be relayed to your Gmail account. To do so, please open a new file /etc/aliases and create a root alias as in the example below (replace [email protected] with your email address):
root: [email protected]
DragonFly Configuration
DragonFly agent configuration is pretty simple. You must add your Gmail credentials in /etc/dma/auth.conf file, and you must enable several options in DragonFly's main configuration file at /etc/dma/dma.conf.
DragonFly is a simple application; unfortunately, it doesn't support modern security standards. If you enabled 2-step verification on your Gmail account (and I hope you did), supplying your username and password in /etc/dma/auth.conf will not work. Since the DragonFly agent doesn't have the mechanism to use 2-step verification, you must create a unique application password to overcome that obstacle. You can do this on the Google's App password website. Once you're there, you will be asked to type in the name for your application password, so please do so:
[email protected]|smtp.gmail.com:apppassword
SMARTHOST smtp.gmail.com
PORT 587
ALIASES /etc/aliases
SPOOLDIR /var/spool/dma
AUTHPATH /etc/dma/auth.conf
SECURETRANSFER
STARTTLS
echo "This is a test message." | mail -s "Test Email" [email protected]