Script that installs/configures a Dovecot, Postfix, Spam Assassin, OpenDKIM Debian web server
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
I wrote this script during the gruelling process of installing and setting up an email server. It perfectly reproduces my successful steps to ensure the same setup time and time again.
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.
Read this readme and peruse the script's comments before running it. Expect it to fail and you have to do bug testing and you will be very happy when it actually works perfectly.
mail.subdomain. Create a nginx/apache site at
mail.and get a certificate for it with Let's Encrypt's Certbot.
mail.. 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 receipients spam folder; it will never make it to them.
apt purgeall your previous (failed) attempts to install and configure a mailserver. Get rid of all your system settings for Postfix, Dovecot, OpenDKIM and everything else. This script builds off of a fresh install.
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 your
~/.muttrcand 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:
The last point is important. Many email systems use a full email address on login. Since we just simply use local PAM logins, only the user's name is used (this makes a difference if you're using my mutt-wizard, etc.).
You're a big boy now if you have your own mail server!
You can tweak Postfix (sending mail
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.