How to add e-mail accounts to Postfix on Ubuntu Server 20.04

Follow these steps to add e-mail account:

Step 1 : Create a new user account:

Step 2 : Get the UID and GID for this account

Step 3 : Create a base directory layout for domains and users

Step 4 : Allow only the user usermail to access these files:

Step 5 : Next, configure Postfix. Edit /etc/postfix/main.cf and add the following lines:

Step 6 : Create the file virtual_domains under /etc/postfix

Step 7 : Create the virtual_maps file

Step 8 : Create the virtual_alias file and optionally set a redirect

Step 9 : Now generate database of virtual maps and aliases by hashing respective files:

Step 10 : Reload Postfix

Step 11 : send an e-mail to the newly created address: