You own a domain and a VPS, and you want mail to [email protected] to land in your Gmail inbox. Setting up email forwarding on your VPS sounds like a job for a mail server, but it is not. Skip the mail server and let a free email forwarding service handle the routing. This guide shows you how, with Cloudflare Email Routing and two solid alternatives.
Forwarding is different from hosting mail. Your domain accepts mail and passes it straight to an inbox you already use. Nothing is stored on your server, and you never touch port 25. For a personal site or a small business contact address, that is usually all you need.
Why forward mail instead of running a mail server
Running your own mail server on a VPS is a real project. You need Postfix, Dovecot for mailboxes, spam filtering, TLS certificates, SPF, DKIM, and DMARC records, plus monitoring so your IP stays off blocklists. Many VPS providers block outbound port 25 by default, and budget hosts often start with a poor sending reputation. If you want the full picture, read our guide to setting up a mail server on your VPS without getting blacklisted before you commit to that path.
Email forwarding on your VPS avoids all of that. The forwarding service receives mail for your domain and delivers it to your real inbox, and your VPS runs no mail software at all. The trade-off is control: no mail stored on the server, no real mailboxes, and a third party in the middle. For most small sites, that trade is worth it.
What you need before you start
- A domain name you control, with access to its DNS settings.
- An inbox that will receive the forwarded mail, such as Gmail, Outlook, or Proton Mail.
- Access to your DNS zone, either at your registrar or at Cloudflare. If you have not pointed your domain at your server yet, follow our guide to point a new domain to your VPS and set up free HTTPS first.
- About 20 minutes. DNS changes can take a few minutes to a few hours to spread, so test after the records have had time to propagate.
How to set up email forwarding on your VPS with Cloudflare Email Routing
Cloudflare Email Routing is a free email forwarding service built into Cloudflare, and it is the option we recommend first. It costs nothing and works even if your site is not hosted behind Cloudflare’s proxy. You only need your domain’s DNS on Cloudflare, and if it is not there yet, you can move the nameservers for free, which also lets you put Cloudflare’s free CDN in front of your VPS later.
Step 1: Turn on Email Routing in the Cloudflare dashboard
Log in to Cloudflare, open your domain, and go to Email, then Email Routing. Click Get started and enter a destination address, the inbox where forwarded mail should land. Open the verification email Cloudflare sends and click the link; routing stays paused until you verify.
Step 2: Add a routing rule
Click Create address and enter the local part, for example contact for [email protected]. Choose your verified inbox as the destination and save. You can also create a catch-all rule that forwards every address on the domain to one inbox. That catches typos, but it also catches spam sent to random addresses, so only enable it if you need it.
Step 3: Add the MX records Cloudflare shows you
Cloudflare will show you three MX records to add to your domain’s DNS. Add them exactly as shown, and remove any old MX records first. Two sets of MX records pointing at different services will split your mail, and half your messages will vanish. After saving, check the records from your VPS with this command:
dig MX yourdomain.com +short
You should see the three Cloudflare mail servers. If you still see old records, wait and run the command again; DNS caching is the usual cause.
Step 4: Add the SPF record
Cloudflare also gives you an SPF record to add as a TXT record on your domain. It tells receiving servers that Cloudflare is allowed to handle mail for your domain. Add it exactly as shown. If you already have an SPF record, do not create a second one. Merge the two into a single TXT record, since a domain with two SPF records fails the check outright.
Step 5: Send a test message
Send an email from a different account to [email protected]. It should arrive within a minute or two, so check the spam folder too. If it lands in spam, check the SPF record first. Once one test lands in the inbox, add a second rule for [email protected] and test that one as well.
Option 2: ImprovMX and Forwardemail
If your DNS is not on Cloudflare and you do not want to move it, ImprovMX and Forwardemail are two free services that work with any DNS provider. Both have a free tier that covers a small site, and both follow the same pattern: point your MX records at them, add their SPF record, and list your forwarding addresses. Check official pricing before you rely on a free tier for a busy mailbox.
For ImprovMX, create a free account, add your domain, and set the destination inbox. ImprovMX will show you two MX records, mx1.improvmx.com with priority 10 and mx2.improvmx.com with priority 20, plus an SPF record to add as a TXT record. Add an alias such as [email protected] pointing at your Gmail address and save.
For Forwardemail, the setup is similar: add your domain, add the MX records mx1.forwardemail.net and mx2.forwardemail.net, add their SPF record, and create aliases in the dashboard. Forwardemail is open source, which suits self-hosters who like to read the code behind a service they trust.
Both services forward email to Gmail or any other inbox, and both support catch-all addresses and multiple aliases on the free tier. The main difference from Cloudflare is where your DNS lives. If your DNS is already on Cloudflare, stay there. If it is at your registrar, pick one of these two instead of moving nameservers for a single feature.
Cloudflare vs ImprovMX vs Forwardemail
| Service | Free tier | Needs DNS on Cloudflare | Catch-all |
|---|---|---|---|
| Cloudflare Email Routing | Yes, unlimited addresses | Yes | Yes |
| ImprovMX | Yes, limited aliases | No | Yes |
| Forwardemail | Yes, limited aliases | No | Yes |
All three only forward incoming mail. None of them lets you send mail from your domain address by itself. If you reply from Gmail, the reply comes from your Gmail address unless you set up Gmail’s “Send mail as” with an SMTP service. Our guide to setting up email sending from your VPS without landing in spam covers the sending side in detail.
Test your setup and fix common problems
Most forwarding problems come from DNS, not from the forwarding service. Work through these checks when a test message does not arrive.
- Wrong MX records. Run
dig MX yourdomain.com +shortfrom your VPS and compare the output with what your forwarding service shows. Old MX records left behind are the most common cause of lost mail. - SPF record missing or duplicated. Run
dig TXT yourdomain.com +shortand look for a single record starting withv=spf1. Two SPF records will fail validation and push your mail toward spam. - DNS has not propagated yet. Changes can take minutes or hours, so check with an online DNS checker before you change anything else.
- Mail lands in spam. Besides SPF, add a DMARC record:
v=DMARC1; p=none; rua=mailto:[email protected]as a TXT record on_dmarc.yourdomain.com. It tells receivers what to do with mail that fails checks. - Forwarded mail is rejected by Gmail. Gmail sometimes rejects forwarded mail when the original sender has a strict DMARC policy. This is a known limit of plain forwarding, and Cloudflare rewrites the sender to work around it. If you see bounces mentioning DMARC, turn on sender rewriting if your service offers it.
Test it once a month: forwarding is quiet when it works and silent when it breaks, and a monthly test catches a DNS change before a customer email goes missing.
What forwarding cannot do
Forwarding covers incoming mail only. It does not give you a mailbox on your VPS, it does not store old messages, and it does not let you send mail as [email protected] on its own. If you need real mailboxes or sending from your domain, you need a hosted mailbox provider or a full mail server, a bigger commitment in time and upkeep.
For a contact address, a support address, and a handful of aliases, forwarding is the right tool. Pick Cloudflare Email Routing if your DNS is already there, or ImprovMX or Forwardemail if it is not. Add the MX and SPF records, send a test message, and you are done. Your VPS stays a web server, and your inbox stays where it already is.