Docs / Email Servers / Stalwart JMAP Mail Server Installation

Stalwart JMAP Mail Server Installation

By Admin · Apr 2, 2026 · Updated Apr 23, 2026 · 6 views · 3 min read

Managing stalwart effectively is a crucial skill for any system administrator. This tutorial provides step-by-step instructions for jmap configuration, along with best practices for production environments.

Prerequisites

  • Valid PTR (reverse DNS) record configured
  • A registered domain name (for public-facing services)
  • A clean IP address not on any blacklists

Server Installation

Security should be a primary consideration when configuring stalwart. Always use strong passwords, keep software updated, and restrict network access to only the necessary ports and IP addresses.


# Install Postfix and Dovecot
sudo apt update
sudo apt install -y postfix dovecot-core dovecot-imapd dovecot-lmtpd

# Configure Postfix main.cf
sudo postconf -e 'myhostname = mail.example.com'
sudo postconf -e 'mydomain = example.com'
sudo postconf -e 'smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem'
sudo postconf -e 'smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem'

Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.

  • Test your backup restore procedure monthly
  • Enable automatic security updates for critical patches
  • Keep your system packages updated regularly
  • Monitor disk space usage and set up alerts

Authentication Setup (SPF/DKIM)

It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.


# Generate DKIM key
sudo apt install -y opendkim opendkim-tools
sudo mkdir -p /etc/opendkim/keys/example.com
sudo opendkim-genkey -b 2048 -d example.com -D /etc/opendkim/keys/example.com -s default -v

# Add the DNS TXT record from:
cat /etc/opendkim/keys/example.com/default.txt

The configuration above sets the recommended values for a VPS with 2-4GB of RAM. Adjust the memory-related settings proportionally if your server has different specifications.

Configuration Options

The jmap component plays a crucial role in the overall architecture. Understanding how it interacts with stalwart will help you make better configuration decisions.

Client Configuration

Performance benchmarks show that properly tuned stalwart can handle significantly more concurrent connections than the default configuration. The key improvements come from adjusting worker processes and connection pooling.


# Install Postfix and Dovecot
sudo apt update
sudo apt install -y postfix dovecot-core dovecot-imapd dovecot-lmtpd

# Configure Postfix main.cf
sudo postconf -e 'myhostname = mail.example.com'
sudo postconf -e 'mydomain = example.com'
sudo postconf -e 'smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem'
sudo postconf -e 'smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem'

Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.

Common Issues and Solutions

  • Slow performance: Check for disk I/O bottlenecks with iostat -x 1 and network issues with mtr. Review application logs for slow queries or requests.
  • Permission denied errors: Ensure files and directories have the correct ownership. Use chown -R to fix ownership and chmod for permissions.
  • High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.

Wrapping Up

Following this guide, your stalwart setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.

Was this article helpful?