This guide will help you set up your own mail server while you learn how email transport and delivery works on the internet nowadays. I have maintained this guide since Debian Woody was released in 2002. Back then it took me weeks to get all the information I needed. Has that really been 16 years by now? Wow. Thank you all for your kind feedback and support – I would probably have discontinued this guide without you. And this is already the eigth edition.

See Marc Guillaume’s french translation if you prefer french.



Latest changes:

I am publishing this guide without any commercial interest. It just makes me happy to see more and more leisure sysadmins leave public freemail providers and operate their own servers. If you feel you would like to return the favor you can easily make me happy by clicking on the donation link at the bottom of this page. And please respect the copyright. I have seen literal copies of my work on the internet by people even making money with it. That’s annoying.

So what will the mail server cost you? The only recurring costs you may face are for running your mail server and for renting a domain. Cheap virtual servers are usually available at around $5 / 5€ per month and have enough power to run a mail server for your friends and family. The software being used is completely free and open-source. You can even make money with it. After all it is called “ISPmail” (ISP = internet service provider). Are you a sysadmin and your employer needs a mail server for their 500 employees? Go with this guide.

What your mail server can do

Receive emails on your domain(s).

emails on your domain(s). Filter out spam and malware.

out spam and malware. Send emails out to any other servers/domains on the internet. Connections will be encrypted when possible.

emails out to any other servers/domains on the internet. Connections will be encrypted when possible. Add cryptographic signatures ( DKIM ) to outgoing emails.

) to outgoing emails. Store as many emails for as many email addresses as you have disk space. Set limits (“quotas”) per user.

as many emails for as many email addresses as you have disk space. Set limits (“quotas”) per user. Let your users fetch email using IMAP or POP3 and send email through your servers using SMTP .

or and send email through your servers using . Allow users to manage server-based filter rules . Distribute incoming emails to different folders. Forward copies. Or send out-of-office notifications.

. Distribute incoming emails to different folders. Forward copies. Or send out-of-office notifications. Provide a webmail interface so users can access their emails securely from any location.

interface so users can access their emails securely from any location. Mitigate brute force attacks.

What you will need

Linux experience . Preferably a Debian-derivative. No godlike skills required. But know your basics: navigating through the file system, editing files, watching log files and having basic understanding of DNS and SQL (SELECT, INSERT, rows, columns).

. Preferably a Debian-derivative. No godlike skills required. But know your basics: navigating through the file system, editing files, watching log files and having basic understanding of DNS and SQL (SELECT, INSERT, rows, columns). Time . 2 hours to 2 days depending on your skills.

. 2 hours to 2 days depending on your skills. A server that runs with Debian Stretch. 1 GB of RAM and a 20 GB disk is fine for your friends and family. Rent a cheap virtual server. Or use a decommissioned laptop. Other Linux distributions likely come with other versions of the software and have different default configuration – so your mileage may vary if you use anything else than Debian.

that runs with Debian Stretch. 1 GB of RAM and a 20 GB disk is fine for your friends and family. Rent a cheap virtual server. Or use a decommissioned laptop. Other Linux distributions likely come with other versions of the software and have different default configuration – so your mileage may vary if you use anything else than Debian. A public IP address that does not belong to a range of typical ISP customers. You usually can’t operate the mail server from a dialup IP address at home because those IP ranges are globally blacklisted. Make sure that your IP address is not blacklisted before you start.

that does not belong to a range of typical ISP customers. You usually can’t operate the mail server from a dialup IP address at home because those IP ranges are globally blacklisted. Make sure that your IP address is not blacklisted before you start. An internet domain (or more) to receive emails for. You need to be able to set A, MX and TXT records for that domain.

(or more) to receive emails for. You need to be able to set A, MX and TXT records for that domain. Patience. We will proceed slowly and after every step ensure that you made no mistakes. Don’t hurry and skip parts even if they appear confusing at first. If you get lost just submit your question at the bottom of any page throughout this guide and help is on the way.

What this is not about

If you are lazy or in a hurry or just don’t want to learn about mail servers then this guide is not for you. There are ready solutions like iRedMail that you may want to consider. Running a mail server requires a certain technical understanding. And that’s what the ISPmail guide is for. Experience from giving support to other sysadmins shows that most problems appear because some detail in a complex setup goes wrong and they have no idea how to track it down. Email has evolved a lot over the past 40 years. Go with ready solutions if you like. But I have a feeling that we meet again. And you will probably not save time either taking the easy route. Or as one of the first long-haired nerds put it…

Everything should be made as simple as possible, but no simpler.

(Albert Einstein)

Ready?

The whole tutorial is split into several pages. Please use the links on the right side to navigate through the pages. Make sure you have the server, a non-blacklisted IP and a domain ready. Let’s go.