How to Make an Email Server with a VPSSetting 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!

UltaHost VPS Hosting

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.

UltaHost VPS SSH Login

Then click New terminal console.

UltaHost VPS SSH Terminal Console

Step 2. Buy a Domain and Setup the Initial DNS

Go to Namecheap and buy a domain.

Buy a Domain on Namecheap Web Shanks

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.

Add Initial DNS Records Cloudflare Namecheap

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.

UltaHost Request Hostname and rDNS

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 -

Install FastPanel UltaHost VPS

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.

License issuance FastPanel

Then follow the link in your email to confirm.

Waiting for confirmation

Login using the login credentials sent to your email.

FastPanel Login

Then get a license.

Get License FastPanel

Add to cart.

FastPanel Checkout

Enter your server IP.

The IP address of the server to which the license will be installed

Then check out your free license.

FastPanel Checkout License Free

Then go to My Services to see your free license.

FastPanel License List

Activation key FastPanel

Go back to your FastPanel website and login using the credential generated by FastPanel after installation.

FastPanel Website Login

Enter your email address and accept the license agreement.

Enter Email Address FastPanel

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.

FastPanel Panel Address

Then click SSL to issue a certificate.

Issue SSL Cert FastPanel Panel Address

Just select Let’s Encrypt.

Select the certificate type

Then you can now access your FastPanel using your domain with port 8888.

Access FastPanel with SSL Certificate

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.

Create Site FastPanel

Choose CMS based site.

Create a CMS Based site

Enter the domain name for your new site.

FastPanel Creating a CMS based site

Choosing CMS

Choose the user for the site.

User SelectionNow your site has been created!

Site Created in FastPanel

Let’s issue an SSL for our domain.

From your site card, go to SSL certificates.

SSL Certificate for FastPanel Domain

Click New certificate.

New certificate FastPanel

Then choose 2048 length and click Save.

New certificate (webshanks.shop)

Finally, our site is secure!

Website Using SSL Cert in FastPanel

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.

FastPanel DKIM

This is what your DNS records would look like.

Complete DNS Config for Mail Server in FastPanel

Step 6. Create Email Accounts

Once your email server is set up, you can create email accounts:

  1. In FastPanel choose your domain, and go to the Mail section.
  2. Click on Mailboxes.
  3. Enter the desired email address and password.
  4. Set any additional options (e.g., storage quota).
  5. Click Save to finalize the account.

Create New Mailbox in FastPanel

New Mailbox for Webshanks.shop in FastPanel Mail server

Once your mailbox is created, navigate back to Mail and click on Roundcube.

Access Roundcube FastPanel

Login using the mailbox credentials you created.

FastPanel Webmail Login

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.

Send a Test Email to Mail-Tester - FastPanel Email Server

We got a 10/10 score in Mail-Tester!

FastPanel Email Server 10-10 Score in FastPanel

Our testing doesn’t end there.

Let’s send an email to Gmail and Proton Mail.

We received it directly in our Gmail inbox!

FastPanel Email server received directly to our Inbox!

Let’s reply to the email with thanks!

And yes we received it in our own email server!

Gmail Reply Receive in FastPanel 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.

Leave a Reply

Your email address will not be published. Required fields are marked *