I wrote this script during the grueling process of installing and setting up an email server. It perfectly reproduces my successful steps to ensure the same setup time and time again, now with many improvements.
I'm glad to say that dozens, hundreds of people have now used it and there is a sizeable network of people with email servers thanks to this script.
I've linked this file on Github to a shorter, more memorable address on my website so you can get it on your machine with this short command:
curl -LO lukesmith.xyz/emailwiz.sh
When prompted by a dialog menu at the beginning, select "Internet Site", then
give your full domain without any subdomain, i.e.
<yourdomain.com>(not mail subdomain). If you would like IPv6, you can do the same for that. This has been tested on Vultr, and all decent VPS hosts will have a section on their instance settings page to add a reverse DNS PTR entry. You can use the 'Test Email Server' or ':smtp' tool on mxtoolbox to test if you set up a reverse DNS correctly. This step is not required for everyone, but some big email services like Gmail will stop emails coming from mail servers with no/invalid rDNS lookups. This means your email will fail to even make it to the recipients spam folder; it will never make it to them.
apt purgeall your previous (failed) attempts to install and configure a mail server. Get rid of all your system settings for Postfix, Dovecot, OpenDKIM and everything else. This script builds off of a fresh install.
ufw, just run:
ufw allow 587on ports 587, 993 and 25 (you will need port 80 for Certbot too).
Let's say we want to add a user Billy and let him receive mail, run this:
useradd -m -G mail billy passwd billy
Any user added to the
usermod -a -G mail cassie
A user's mail will appear in
~/Mail/. If you want to see your mail while ssh'd
in the server, you could just install mutt, add
set spoolfile="+Inbox" to
~/.muttrc and use mutt to view and reply to mail. You'll probably want
to log in remotely though:
Let's say you want to access your mail with Thunderbird or mutt or another email program. For my domain, the server information will be as follows:
In previous versions of emailwiz, you also had to log on with only your
luke) rather than your whole email address (i.e.
[email protected]), which caused some confusion. This is no longer the
I am always glad to hear this script is still making life easy for people! If this script or documentation has saved you some frustration, you can donate to support me at lukesmith.xyz/donate.
journalctl -xeto see the specific problem.