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.
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.”
- 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.
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.
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 asyourdomain.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.
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.
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).
- On the app card, open the gear icon (Settings) and switch to the App environment tab.
- 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. - Sign in to Mail Administration with the username
adminand this password.
Mail Administration is in English, so the labels in this guide match the English interface.
- In Mail Administration, open Directory → Accounts and click Create user.
- Under Username, enter the part before the @ symbol, such as
info, and select your mail domain under Domain. - Under Credentials, click Add item and set a secure password.
- Add other addresses for the same mailbox, such as
contact@yourdomain.com, under Email Aliases. - 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.
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.
| Record | Type | Purpose |
|---|---|---|
| MX | MX | Tells other mail servers where to deliver email for your domain. Required. |
SPF (v=spf1 …) | TXT | Specifies which server is allowed to send email for your domain. Required. |
DKIM (…._domainkey) | TXT | Public key used to sign your emails. Required. |
DMARC (_dmarc) | TXT | Tells recipients what to do with emails that fail SPF/DKIM validation. Recommended. |
| SRV and TLS-RPT | SRV / TXT | Help mail apps configure themselves and provide reports. Optional. |
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.
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:
- Open your VPS and switch to Settings.
- Under Reverse DNS, enter the app’s domain in the Hostname field for the primary IP address, for example,
www.yourdomain.com. - Click Save.
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.
Receiving email and sending emails between your own mailboxes work immediately, even without a verified phone number.
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:
| Setting | Value |
|---|---|
| Server (IMAP and SMTP) | App domain, for example, www.yourdomain.com |
| Username | Full email address |
| IMAP | Port 993, SSL/TLS |
| SMTP | Port 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.
You can use multiple email domains in the same app:
- On the app card, open Settings (gear icon) and select the App actions tab.
- Enter the domain under Additional Domains and leave Also create as mail domain enabled.
- 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.
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.
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.
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.
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.
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.
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.
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.
