Webmin is an awesome tool for people self-hosting WordPress on a VPS (Digital Ocean or Vultr) or dedicates server. It can help bridge the gap when moving from the chains of cPanel to a more flexible solution since you can add cronjobs, update your Linux distribution’s packages and more management tasks.
I like to get email alerts from Webmin when a cronjob has fired and if there are software package updates. This guide shows you how to configure Webmin to send emails via Mailgun, the same approach can be used for sending email from your Google account. I will assume you already have Webmin installed and have signed up to Mailgun.
Configure Webmin Email Alerts with Mailgun
First make sure you have the perl sasl module installed, on Debian and Ubuntu systems this will install it
sudo apt-get update
sudo apt-get install libauthen-sasl-perl -y
Log in to Webmin on port 10000 with your root or sudo user.
In the left menu select Webmin > Webmin Configuration
Then choose Sending Email
For Send email using, select Via SMTP to remote mail server and enter smtp.mailgun.org
Check Use SSL encryption and Use port number should be 465
For SMTP server authentication choose Login as and enter your Mailgun postmaster username with password.
For SMTP authentication method choose Login
You can set the From address for email from Webmin too.
Click Save.
Now try sending a test email from Webmin with these options.
Send message to is where Webmin will try and send the email to.
Message subject is the subject of the test email
Message contents can be whatever you want.
Click Send Email.
Make sure port 465
is allowed in your firewall, if you are using ufw
this should do the trick
ufw allow 465/tcp