How to configure Webmin to send email using a Gmail account

SYSTEM INFORMATION
OS type and version Rocky 9.2
Virtualmin version 7.7

In the quest to be able to send emails from both Virtualmin and the servers hosted on it, I set up a free Gmail account for myself for the express purpose of sending emails (to my main account, and to others as needed). Because my server is on a Comcast home (not Business) account, port 25 is blocked by Comcast, preventing me from relaying emails from the server itself. Hence, the need to use a Gmail account.

The configuration is somewhat tricky, and it took me multiple tries to get all the parts lined up correctly, so I am documenting this here for the next person that may run into this.

Step 1 - set up your Gmail account!

The trick here is that you can’t just use your address and password to send the email - you need to enable 2FA on the account, then create an App password for the systems to use. Full details can be found here.

Step 2 - Configure Webmin to use the Gmail account

In Webmin, go to Webmin => Webmin Configuration => Sending Email

Configure your settings as below, substituting the email address you created for the one in the example. Note that the password is the App Password, and not the “main” one to the Gmail account!

You will want to make sure you secure the heck out of your newly created Gmail account - set up multiple forms of 2FA such as a phone number, 6-Digit code, Backup Email, etc.

Hopefully this is helpful for other newbies!

4 Likes

Thanks for that, I will give it a try and this works for all domains on the server?

Make sure you setup your spf, and dmarc, i presume all good with DKIM.

This isn’t for sending emails for the hosted domains, this is for sending email as Webmin - the account that will send notices for system events, backups, etc. The address will always be Gmail.com since it’s using a free Gmail account.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.