Luke Smith 1ab9f432df | 4 years ago | |
---|---|---|
FUNDING.yml | 4 years ago | |
LICENCE | 4 years ago | |
README.md | 4 years ago | |
emailwiz.sh | 4 years ago | |
mailrm.sh | 5 years ago |
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.
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. lukesmith.xyz
.
mail.
subdomain.
Create a nginx/apache site at mail.<yourdomain.com>
and get a certificate
for it with Let’s Encrypt’s Certbot.mail.
subdomain.<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 purge
all 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.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 mail
group will be able to receive mail. Suppose a user
Cassie already exists and we want to let her receive mail to. Just run:
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 ~/.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:
mail.lukesmith.xyz
mail.lukesmith.xyz
In previous versions of emailwiz, you also had to log on with only your
username (i.e. luke
) rather than your whole email address (i.e.
luke@lukesmith.xyz
), which caused some confusion. This is no longer the
case.
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 -xe
to see the specific problem.