Have you ever considered how companies and brands operate their own email servers from their domains, such as Google.com, Microsoft.com, and Amazon.com, which are present in every aspect of their domain.
This prompts curiosity about how this is achieved and what the secret is behind having a personal email server.
Let us guide you through the process of creating an email server on Ubuntu, even if you are a novice.
Let us establish your own email server on Ubuntu.
Why should you create your own email server?
Operating your own mail server provides you with complete authority over your domain or business. It is particularly beneficial for small enterprises, developers, and website proprietors seeking professional email hosting.
Your email confidentiality
Unlimited accounts for your domain
Brand identity for your business or startup
Cost savings compared to third-party email services
Advantages of Operating Your Own Email Server on Ubuntu
Improved Privacy: All emails are securely stored on your Ubuntu server, with no access or data tracking by third parties.
Professional Branding: Every email sent from your domain, such as @designbyk.com, enhances your business identity and fosters trust.
Administrative Control: Directly manage configurations, user accounts, and security policies through Ubuntu.
Complete Data Management: You have the ability to oversee your own backups, saved emails, and message delivery, granting you comprehensive control over everything.
Flexible & Customized: Easily expand to incorporate new users, domains, or email features as your business evolves.
Cost-Effective: There are no monthly fees, only free open-source tools available on your Ubuntu server.
What You Will Require
Before we begin, ensure you have the following prerequisites.
If you are a beginner setting up Ubuntu Server, the recommended versions are: 20.04 or 22.04.
You can install it on AWS, Digital Ocean, Google, or your VPS.
Next, ensure you have a registered domain name.
Let us proceed with the Step-by-Step Guide.
First, open the terminal and log in to the Ubuntu server.
Step 1: Update and Upgrade Your System
To update the system, execute the following command:
“sudo apt update && sudo apt upgrade -y”
Email Server
The upgrade process may take some time,
Once it is finished.
Step 2: Configure Your Hostname and Domain
If you have established your own domain name, proceed to set your server's hostname.
“sudo hostnamectl set-hostname mail.designbyk.com”
Substitute it with your actual domain name.
Next, confirm the hostname and modify your host file.
Step 3: Verification
To verify,
Check the name using “hostnamectl”.
Edit your hostname file and insert the line:
“123.45.67.89 mail.designbyk.com mail”
using your real IP address and domain.
After making the changes, press Ctrl+O to save, then
Ctrl+X to exit.
Step 4: Install Postfix
Postfix serves as a mail transfer agent (MTA), a software utilized on Linux and Unix-like systems for sending, receiving, and routing emails.
To install Postfix, use the command:
“sudo apt install postfix -y”
During the installation process, you will be prompted to configure.
General type of mail configuration, select “Internet Site”, click ok
For the System mail name, enter your domain name (e.g., designbyk.com)
Step 5: To reconfigure the Postfix,
Anytime, use the command in line
“sudo dpkg-reconfigure postfix”
then if it is not configured, then,
Add and confirm the lines with your
Use the command “sudo nano /etc/postfix/main.cf” and then add your actual domain name
Step 6: Then restart Postfix
with the command
“sudo systemctl restart postfix”
Check the status of Postfix, “sudo systemctl status postfix”, and click Enter
It starts to activate and shows the status.
Step 7: Configure Dovecot
Dovecot is for receiving the mail. Let’s set up with the format of maildir and SSL,
and use the command to open Dovecot. configuration
Press “Enter”, it will move on to the page of configuration, and find these lines
“#mail_location =”
Step 8: Mail. Directory
change it into these lines of command in Maildir
“maildir:~/maildir”
Press Ctrl+O to save, and
Ctrl+X to exit.
Step 9: status check
It helps to direct all the stored mail inside the maildir folder in each user’s home directory
Step 10: Add SSL (Let’s Encrypt)
By adding SSL, when you visit and send an email, information such as your username, password, and other personal data travels securely through the network.
use the command
Find the line as “ssl = yes” and change it to “required”
And use the command in lines instead of it.
Save and exit the page
Step 12: Create a Mail User
Now, create your first mail user account and set the password
Give the details information for the mail user,
Step 13: User information
Press Enter to default the information of users
Once the information that you have given is correct,
Then click “y”
Finally, you can test sending and receiving with the mail test
“echo “Hello from your Ubuntu Mail Server!” | mail -s “Test Email” youremail@gmail.com”
If it has arrived, then
your email server is ready!
Frequently Asked Questions (FAQ)
1. Can I use my personal computer as an email server?
You can, but it’s not recommended to use a VPS or cloud server for better uptime and reliability.
2. Is it safe to host my own email server?
Yes, if secured with SSL, SPF, DKIM, and a firewall to protect against spam and attacks.
3. Why are my emails going to the spam folder?
This happens if SPF, DKIM, or DMARC records are missing or if your IP is blacklisted.





Top comments (0)