Setting up your own email server is a powerful way to gain full control over your email communication, improve privacy, and avoid costly third-party email services. In this guide, I’ll show you how to make an email server with a VPS using UltaHost running Debian 12, FastPanel, and a domain from Namecheap.
By following this tutorial, you’ll have a fully functional email server in no time.
Prerequisites
Before we dive into the steps of how to make an email server with a VPS, ensure you have the following:
- A VPS from UltaHost (we’ll be using Debian 12)
- A domain name (preferably from Namecheap)
- Basic knowledge of Linux command line
- Patience and willingness to learn
Step-by-Step Guide: How to Make an Email Server with a VPS
Setting up your own email server offers numerous benefits, including enhanced privacy, customization options, and cost-effectiveness. While the process may seem daunting at first, with the right tools and guidance, you can successfully create a robust email server on your VPS.
Step 1. Set Up Your UltaHost VPS
First, you’ll need to set up your UltaHost VPS. Follow my instructions to create and access your Debian 12 server.
Why did I choose this VPS? Because it has an open port 25!
Once you’ve setup your VPS, login using a free SSH client. I will be using Bitvise.
Put your server IP in the Host field and your username is root. For advanced users, create SSH keys to connect to your server securely.
Then click New terminal console.
Step 2. Buy a Domain and Setup the Initial DNS
Go to Namecheap and buy a domain.
Pro tip: Do not buy a domain that has TLDs that look like you’re going to spam like .xyz .loans .biz .love etc. Instead, buy TLDs like .com .ai .io .org.
Then create a free Cloudflare account and connect your domain from Namecheap.
Add A records for our domain and mail hostname. Refer to the image below.
Wait for at least a few hours for the DNS to propagate. You can check the propagation process using DNS checker.
Once propagated, go back to your UltaHost and ask their support to set the hostname and rDNS to your mail hostname in my case is mail.webshanks.shop.
Step 3. Install FastPanel
To install FastPanel on your UltaHost VPS, run these commands:
apt-get update; apt-get install wget
wget http://repo.fastpanel.direct/install_fastpanel.sh -O - | bash -
Once installed, access FastPanel using https://yourServerIP:8888.
If you face a security error, just proceed and we will issue an SSL certificate for our panel address later on.
Then enter your email address to get a free license.
Then follow the link in your email to confirm.
Login using the login credentials sent to your email.
Then get a license.
Add to cart.
Enter your server IP.
Then check out your free license.
Then go to My Services to see your free license.
Go back to your FastPanel website and login using the credential generated by FastPanel after installation.
Enter your email address and accept the license agreement.
We will set a panel to access our FastPanel using a subdomain.
Go to the menu on the top left and click Settings > Panel Addresses.
Then click SSL to issue a certificate.
Just select Let’s Encrypt.
Then you can now access your FastPanel using your domain with port 8888.
Step 4. Add a Site
To add a site in FastPanel, you’ll typically follow these steps:
From your FastPanel dashboard, click on Create site.
Choose CMS based site.
Enter the domain name for your new site.
Choose the user for the site.
Now your site has been created!
Let’s issue an SSL for our domain.
From your site card, go to SSL certificates.
Click New certificate.
Then choose 2048 length and click Save.
Finally, our site is secure!
Step 5. Configure DNS Settings
Go back to your Cloudflare account and set up the following DNS records:
1. MX record: Set up mail exchange for your domain
Record Type | Name | Content | Priority | TTL |
MX | webshanks.shop | mail.webshanks.shop | 10 | Auto |
2. SPF record: Create a TXT record for Sender Policy Framework
TXT @ v=spf1 a mx ip4:216.74.123.244 -all
3. DMARC record: Enforce policies for handling emails that fail SPF or DKIM checks.
TXT _dmarc v=DMARC1; p=quarantine; pct=100
4. DKIM record: Set up DomainKeys Identified Mail. You can find your DKIM through Site card > Mail > DKIM.
This is what your DNS records would look like.
Step 6. Create Email Accounts
Once your email server is set up, you can create email accounts:
- In FastPanel choose your domain, and go to the Mail section.
- Click on Mailboxes.
- Enter the desired email address and password.
- Set any additional options (e.g., storage quota).
- Click Save to finalize the account.
Once your mailbox is created, navigate back to Mail and click on Roundcube.
Login using the mailbox credentials you created.
Step 7. Test the Email Server
This is the most exciting part – testing. Let’s test our email server on Mail-Tester.
I’ll be using a text email template.
We got a 10/10 score in Mail-Tester!
Our testing doesn’t end there.
Let’s send an email to Gmail and Proton Mail.
We received it directly in our Gmail inbox!
Let’s reply to the email with thanks!
And yes we received it in our own email server!
So this is how to make an email server with a VPS.
Step 8. Configure Email Clients
To use your new email server, you’ll need to configure your email clients. Use the following settings:
- Incoming server: mail.yourdomain.com (IMAP)
- Outgoing server: mail.yourdomain.com (SMTP)
- Use SSL/TLS for secure connections
- Use the full email address as the username
- Use the password connected to your email
FAQs
Is it difficult to make an email server with a VPS?
While it requires some technical knowledge, following this guide on how to make an email server with a VPS simplifies the process considerably.
Can I host multiple domains on my email server?
Yes, you can. Check out our guide on how to add additional domains and emails to your mail server.
How do I ensure my email server is secure?
Regularly update your server, use strong passwords, enable SSL/TLS, and implement spam filters. Consider using a manual and automatic IP and domain warmup guide to improve deliverability.
Conclusion
By following this guide on how to make an email server with a VPS using UltaHost, Debian 12, FastPanel, and Namecheap, you’ll have full control over your email communication. Managing your own email server is a rewarding experience that improves both privacy and flexibility.
Remember to keep your server updated and secure to ensure smooth operation.
Don’t forget to check out our other guides on setting up email servers with different VPS configurations.