10 Jan 22
Often you will have to setup a mail server especially when you own a web server or VPS, however, this task is dauntingly hard, since mail is an old product. So, here I would like to jot down a step by step guide to walk through the setup of a simple mail server. By the end of this article, a working IMAP/POP3 server will be up. Nonetheless, if any extra stuff (e.g. the use of spam filter or so) is needed, they can be installed on top later.
First, we have to install “postfix” as the MTA and “mailx” as the mail utility.
sudo apt-get install postfix sudo apt-get install mailx
Then, we will create a user on ubuntu as the mail user account
sudo useradd -m -s /bin/bash <username> sudo passwd <username>
Now, the first step is done, and we might have a test on it by issuing
netcat localhost 25
and it should prompt you with this
220 localhost ESMTP Postfix (Ubuntu)