|James Puleo 513c338a3f
|10 months ago
|2 years ago
|2 years ago
|1 year ago
|10 months ago
This script installs an email server with all the features required in the modern web.
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, e.g.
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.
mail. subdomain to your
server’s IP (IPv4 and IPv6). This is required on initial run for certbot to
get an SSL certificate for your
While the script enables your mail ports on your server, it is common practice for all VPS providers to block mail ports on their end by default. Open a help ticket with your VPS provider asking them to open your mail ports and they will do it in short order.
At the end of the script, you will be given some DNS records to add to your DNS server/registrar’s website. These are mostly for authenticating your emails as non-spam. The 4 records are:
emailwiz.sh and thus must be added after
They will look something like this:
@ MX 10 mail.example.org
mail._domainkey.example.org TXT v=DKIM1; k=rsa; p=anextremelylongsequenceoflettersandnumbersgeneratedbyopendkim
_dmarc.example.org TXT v=DMARC1; p=reject; rua=mailto:firstname.lastname@example.org; fo=1
example.org TXT v=spf1 mx a: -all
The script will create a file,
~/dns_emailwiz that will list our the records
for your convenience, and also prints them at the end of the script.
Set a reverse DNS or PTR record to avoid getting spammed. You can do this at
your VPS provider, and should set it to
mail.yourdomain.tld. Note that you
should set this for both IPv4 and IPv6.
Let’s say we want to add a user Billy and let him receive mail, run this:
useradd -m -G mail 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:
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, donate here:
Can’t send or receive mail? Getting marked as spam? There are tools to double-check your DNS records and more: