A complete mail server solution using Postfix, Dovecot, and Roundcube webmail, deployed with Ansible.
Well, it gives you an infinite number of valid email addresses ending with @yourdomain. And I see many benefits in it
If you register on services with unique emails, it would be hard to match your data between the data leaks
Some services ask only for email confirmation to register and get a trial period. With your own server, a new email is already there
I mean, the email mr@dpttk.ru looks much better than jH0n-wH1cKKK1320-0@gmail.com
I would suggest connecting your mail server to your current email service provider. All major providers support adding third-party email servers to your mailbox. And so, you will have an infinite number of addresses plus your good old current email from one page. Awesome!
- Ubuntu 20.04 server configured with a Fully Qualified Domain Name (FQDN)
- A non-root user with sudo privileges
- Domain name with proper DNS records (A, MX, and optionally SPF, DKIM, DMARC)
- Ansible installed (version 2.9 or higher)
- Required Ansible collections:
ansible-galaxy collection install community.generalansible-galaxy collection install community.mysql
-
Clone this repository:
git clone https://github.com/yourusername/AutoMail.git cd AutoMail -
Update the inventory file with your server information:
nano inventory/hosts.ini -
Configure variables for your environment:
nano group_vars/all.yaml nano group_vars/vault.yaml ansible-vault encrypt group_vars/vault.yaml -
Run the playbook:
ansible-playbook -i inventory/hosts.ini site.yaml --ask-vault-pass
The main configuration variables are stored in group_vars/all.yaml:
domain: Your domain nameemail: Email for Let's Encrypt certificatecollector_name: The username receiving all mailmail_password: Password for the mailboxmariadb_password: MariaDB root password (if using MariaDB instead of SQLite)roundcube_db_password: Roundcube database password
After installation:
- Access webmail at
https://your-domain/roundcube - Configure mail clients using IMAP/SMTP with your domain credentials
- All emails to the domain will be collected in the specified collector mailbox
- Check mail logs:
tail -f /var/log/mail.log - Verify Postfix configuration:
postfix check - Test Dovecot with:
telnet localhost 143(IMAP) ortelnet localhost 110(POP3) - Examine Apache logs:
tail -f /var/log/apache2/error.log
- All passwords should be changed from defaults
- Use Ansible Vault for sensitive information
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the WTFPL