Skip to content

Web Hosting: Set Up Email with Your Own Mail Server

Set up your own mailboxes for your domain on your VPS with the ZAP Webspace + Mail app. Learn how to install it, create mailboxes, configure DNS and reverse DNS, and enable email sending.

30 November 20269 min read216 Views0 helpful

Introduction

Would you like to use your own email addresses for your domain, such as info@yourdomain.com? Your web hosting is a VPS with One-Click Apps; a mail server is not included automatically. You can set one up yourself in just a few minutes with the ZAP Webspace + Mail app. It combines webspace (PHP, MariaDB, SFTP), the Stalwart mail server, and Roundcube webmail in one app.

This guide first explains when it makes sense to run your own mail server. Then you’ll install the app, create mailboxes, add the DNS records for your domain, enable sending to external recipients, and back up and update your mail server.

When it makes sense to run your own mail server

Running your own mail server on your VPS is a good fit if …

  • you want custom addresses for your domain and want to create mailboxes and aliases yourself.
  • you want your emails stored on your own VPS rather than with an external provider.
  • your website and email go together: With ZAP Webspace + Mail, your website, such as a contact form, can send email directly through your mail server using PHP mail().
  • you manage multiple domains: You can add more mail domains in the same app.
  • you want spam filtering, DKIM signing, and webmail in one app.

Running your own mail server is less suitable if you don’t want to manage DNS records, reverse DNS, and updates yourself. A mail server must also be continuously available: If your VPS restarts or experiences an outage, it can’t receive emails during that time. Sending mail servers will usually try again later. On new VPSs, outgoing connections on ports 25 and 465 are blocked until you verify a phone number in your account (Step 6). Whether your emails reach recipients’ inboxes depends, among other things, on their mail server’s assessment of your DNS records, reverse DNS, and IP address reputation. If you don’t want to manage these things, using an external email provider is more convenient. For details, see “Alternative: External Email Provider.”

Set up a mail server with ZAP Webspace + Mail

Requirements

  • A VPS with One-Click Apps configured (Debian or Ubuntu). For instructions on setting up One-Click Apps, see VPS: One-Click Apps.
  • At least 2 GB RAM for the app.
  • Your own domain whose DNS records you can edit, such as a domain with ZAP-Hosting.
Info

Only one mail app can run on a VPS because the mail server uses fixed ports (25, 465, 587, 993, and 8443). You can add additional mail domains in the same app.

Step 1: Install ZAP Webspace + Mail

Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab. Find “ZAP Webspace” in the App catalog, then click Install next to ZAP Webspace + Mail.

In the installation dialog, select the domain where the app will be accessible:

  • Under Domain Selection, choose your own domain and enter a prefix, such as www. If your domain is with ZAP-Hosting, ZapX will create the A record automatically. If it’s with another provider, select Custom Domain (DNS elsewhere) and add the displayed A record with that provider.
  • Open App configuration and enter the domain for your email addresses in MAIL_DOMAIN, such as yourdomain.com. If you leave the field empty, the app will use its own domain, for example, www.yourdomain.com.

Click Queue installation. The app should show as Online after about two to three minutes. The app card contains the links Website, Webmail, Mail Administration, phpMyAdmin, and DNS records, as well as the ports for your mail apps.

Tip: Upload your website

For instructions on uploading your website via SFTP, using the database, and configuring the PHP version, nginx rules, and cron jobs, see Web Hosting: Set Up a Website with ZAP Webspace. The webspace features work the same way in ZAP Webspace + Mail.

Step 2: Sign in to Mail Administration

Mail Administration is the Stalwart interface. You can access it using the Mail Administration link on the app card (port 8443 on the app domain).

  1. On the app card, open the gear icon (Settings) and switch to the App environment tab.
  2. Under Automatically generated values, find SERVICE_PASSWORD_ADMIN. Click the eye icon to reveal the password or the icon next to it to copy it.
  3. Sign in to Mail Administration with the username admin and this password.
Tip

Mail Administration is in English, so the labels in this guide match the English interface.

Step 3: Create mailboxes and aliases

  1. In Mail Administration, open Directory → Accounts and click Create user.
  2. Under Username, enter the part before the @ symbol, such as info, and select your mail domain under Domain.
  3. Under Credentials, click Add item and set a secure password.
  4. Add other addresses for the same mailbox, such as contact@yourdomain.com, under Email Aliases.
  5. Save by clicking Create.

The new mailbox will then appear in the list. The website@ entry is a technical mailbox that your website uses to send email via PHP mail(). Don’t delete it.

Step 4: Add DNS records for your domain

Your domain needs several DNS records so that emails for it reach your mail server and don’t end up in spam. The app generates these records for you: Click DNS Records on the app card.

Copy these records exactly into your domain’s DNS settings. For a domain from ZAP-Hosting, you can do this in the domain dashboard, as described in Domain: Domain Record Settings.

RecordTypePurpose
MXMXTells other mail servers where to deliver email for your domain. Required.
SPF (v=spf1 …)TXTSpecifies which server is allowed to send email for your domain. Required.
DKIM (…._domainkey)TXTPublic key used to sign your emails. Required.
DMARC (_dmarc)TXTTells recipients what to do with emails that fail SPF/DKIM validation. Recommended.
SRV and TLS-RPTSRV / TXTHelp mail apps configure themselves and provide reports. Optional.
Warning

Always copy the values from the DNS Records page for your own app. The DKIM key in particular is different for every installation. It can take anywhere from a few minutes to a few hours for new DNS records to propagate everywhere.

Step 5: Set reverse DNS for your VPS IP

Many mail servers check whether the sender’s IP address points to a matching hostname. Set the reverse DNS (PTR) for your VPS IP to the app’s domain:

  1. Open your VPS and switch to Settings.
  2. Under Reverse DNS, enter the app’s domain in the Hostname field for the primary IP address, for example, www.yourdomain.com.
  3. Click Save.

Step 6: Enable sending to external recipients

To protect against spam, outgoing connections on mail ports 25 and 465 are blocked on new VPSs. You’ll see the notice Email sending is blocked on your VPS. Emails to external recipients will remain queued until you verify a phone number in your account.

Click Verify phone number in the notice, or open My Account → Settings → Profile and verify your phone number there. ZapX will then automatically enable email sending for all your VPSs.

Info

Receiving email and sending emails between your own mailboxes work immediately, even without a verified phone number.

Step 7: Use webmail and mail apps

Use the Webmail link on the app card to sign in with the full email address and the mailbox password.

Use these settings for mail apps such as Thunderbird, Outlook, or the mail app on your smartphone:

SettingValue
Server (IMAP and SMTP)App domain, for example, www.yourdomain.com
UsernameFull email address
IMAPPort 993, SSL/TLS
SMTPPort 587 with STARTTLS or port 465 with SSL/TLS

The certificate is the same one used for the app domain. It will be applied a few minutes after installation.

Add more mail domains

You can use multiple email domains in the same app:

  1. On the app card, open Settings (gear icon) and select the App actions tab.
  2. Enter the domain under Additional Domains and leave Also create as mail domain enabled.
  3. Click Add. ZapX will add the mail domain in Mail Administration and display the required DNS records next to the domain.

For a mail-only domain, only the MX record needs to point to your server; the domain itself doesn’t. Create mailboxes for the new domain as described in Step 3.

Email deliverability

Your emails are sent from your VPS’s own IP address. Its reputation depends only on your own mail traffic. Follow these steps to help your emails reach their destination reliably:

  • Add the MX, SPF, DKIM, and DMARC records (Step 4) and set reverse DNS (Step 5).
  • Start by sending only a few emails, then gradually increase the volume.
  • Your website should use an address on your domain as the sender.

For more information and useful testing tools, see Web Hosting: Troubleshoot Email Issues and Improve Deliverability. To set up SMTP in WordPress, see Web Hosting: Set Up WordPress SMTP.

Back up and update your mail server

Back up your data

Your mailboxes, emails, and settings are stored in the app’s volumes on your VPS, alongside your website and database. They’re backed up as part of your VPS backup: We automatically back up your VPS once a day overnight. You can find the backups in the Backups tab for your VPS. For details on how long they’re kept and how to restore them, see Manage backups: Create, Restore, and Download.

Warning: Restoring affects the entire VPS

A VPS backup is a complete image of the server. Restoring it will roll back the entire VPS to that state. Emails received afterward and mailboxes created afterward will be lost.

You can create an additional backup outside the VPS using Stalwart’s export feature. The mail server must be stopped first. For instructions on exporting and restoring, see the Stalwart backup documentation. Store the export securely, as it also contains passwords and DKIM keys.

Update ZAP Webspace + Mail

Open the app settings (gear icon) > App update and click Check for updates. If a new version is available, install it by clicking Apply update. Mailboxes, emails, files, and the database are stored in separate volumes and will be preserved. The mail server will restart during the update and be briefly unavailable.

The same process applies to the Stalwart app. Before updating, read the Stalwart release notes, which list any potential breaking changes.

For advanced users: the “Stalwart” app

The Stalwart app is also available in the app catalog. It’s the mail server on its own, without webspace, Roundcube, or the setup provided by ZAP Webspace + Mail. You’ll need to configure domains, the TLS certificate, ports, and DNS records yourself in the Stalwart interface. It’s suitable if you’re already familiar with Stalwart and want to configure everything yourself. Setup instructions are available in the official Stalwart documentation.

Alternative: External Email Provider

If you don’t want to run your own mail server, you can use an external provider such as Google Workspace or Microsoft 365 with your domain. You’ll need to add the MX, SPF, and DKIM records provided by the provider to your domain. You don’t need to install anything on your VPS.

Conclusion

With ZAP Webspace + Mail, you can set up your own mailboxes for your domain in just a few steps: install the app, create mailboxes, set DNS records and reverse DNS, and verify your phone number. Your mail server is backed up with your daily VPS backup, and you can install updates under App update. If you need help, our support team will be happy to assist.

FAQ

Frequently asked questions

No. Your web hosting is a VPS with One-Click Apps. Install the mail server yourself using the ZAP Webspace + Mail app from the app catalog. It includes webspace, the Stalwart mail server, and Roundcube webmail.
On the app card, open Settings (gear icon) and select the App Environment tab. Find SERVICE_PASSWORD_ADMIN under Automatically Generated Values. The username is admin.
MX, SPF, and DKIM are required; DMARC is recommended. The app shows the exact values through the DNS Records link on the app card. You should also set reverse DNS for your VPS IP to the app’s domain.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.