emailwiz
Luke Smith's bash script to completely automate the setup of a Postfix/Dovecot/SpamAssassin/OpenDKIM server on debian.
Alternatives
Tech stack
No tech stack added yet. Sign in to suggest some
Introduction
emailwiz is an open-source mail server installation script developed by Luke Smith. It is licensed under GPL-3.0 and has about 2.2k stars on GitHub. It automatically installs and configures all the components a modern mail server needs, so individuals or small teams can quickly get a server that can send and receive email on their own domain and VPS. The author says hundreds of people have used this script to set up their own mail servers.
Installed components
- Postfix: sends and receives email.
- Dovecot: serves mail to email clients such as mutt and Thunderbird over IMAP.
- Secure integration configuration: connects the two above and uses the system's native PAM for login.
- SpamAssassin: filters spam, and you can also customize the filtering rules.
- OpenDKIM: signs outgoing mail so it is delivered smoothly to large mail providers such as Gmail.
- Certbot: automatically obtains an SSL certificate if the server doesn't already have one.
- fail2ban: the relevant modules are enabled for the services above to improve server security.
- Optional self-signed certificate mode: instead of using OpenDKIM and Certbot, it generates a self-signed certificate valid for 100 years.
Design philosophy: keep it simple
- No SQL database: email accounts and passwords simply use regular Unix system users.
- No web mail interface: webmail such as Roundcube or SquirrelMail is not installed, so users need a regular email client such as Thunderbird, K-9 (Android) or mutt (which can be used with mutt-wizard). Users who want a web interface can refer to the Rainloop tutorial on LandChad.net.
Prerequisites
- A Debian or Ubuntu server.
- DNS records set up, at minimum pointing the domain's
mail.subdomain to the server's IP (IPv4 and IPv6). Certbot relies on this to obtain an SSL certificate for themail.subdomain on the first run.
Installation
curl -LO lukesmith.xyz/emailwiz.sh
Run the script after downloading it. When the dialog menu appears at the start, select "Internet Site", then enter your full domain name without any subdomain, for example example.org.
Steps required after installation
- Open the mail ports: VPS providers usually block mail ports by default, so you need to submit a ticket asking for them to be opened.
- Add DNS records: when the script finishes, it displays the records you need to add and also saves them to the
~/dns_emailwizfile. There are 4 records:- MX record
- SPF record (TXT)
- DMARC record (TXT)
- DKIM public key record (TXT), which is the only one generated during installation
- Set up reverse DNS (rDNS/PTR): at your VPS provider, set both the IPv4 and IPv6 addresses to
mail.yourdomain.tldso your mail isn't treated as spam.
Account management
As soon as you add a system user to the mail group, that user can receive mail:
useradd -m -G mail billy
passwd billy
usermod -a -G mail cassie
Mail is stored in the user's ~/Mail/ directory. You can also log in to the server over SSH and read mail directly with mutt.
Client connection settings
- SMTP:
mail.yourdomain, port 465 - IMAP:
mail.yourdomain, port 993
Isolated mode (self-signed certificate)
Enable it by changing selfsigned="no" to "yes" in the script. You can also set use_cert_config="yes" and fill in the country, state/province and organization name so the certificate is generated automatically. This mode suits two kinds of scenarios: collecting notification emails sent by devices on a local network, or building a private communication system over a VPN (such as WireGuard). Note that in this mode, the server cannot send mail directly to public mail servers such as Gmail or Outlook.
Troubleshooting
We recommend first running journalctl -xe to see the specific error, then using tools such as intodns.com and mxtoolbox to check your DNS records and whether your IP is blacklisted.
Discover more
homebox
Suite of Ansible scripts to deploy a fully functional mail server on Debian. Unobtrusive and automatic as much as possible, focusing on stability and security.
iRedMail
Full-featured mail server solution based on Postfix and Dovecot.
Courier MTA
Fast, scalable, enterprise mail/groupware server providing ESMTP, IMAP, POP3, webmail, mailing list, basic web-based calendaring and scheduling services.
DebOps
Your Debian-based data center in a box. A set of general-purpose Ansible roles that can be used to manage Debian or Ubuntu hosts.
EmailRelay
A small and easy to configure SMTP and POP3 server for Windows and Linux.
Enigma 1/2 BBS
Enigma 1/2 is a modern, multi-platform BBS engine with unlimited "callers" and legacy DOS door game support.