Back to articles
Technology Insight

Build Your Own Private Disposable Email Service: A Guide to Self-Hosting Disposable-Mail on a VPS

June 3, 2026

Introduction: The Growing Need for Private Disposable Email Infrastructure

In today's data-driven business landscape, privacy, security, and digital hygiene are paramount. Professionals and developers frequently require temporary email addresses to test software applications, register for trial services, or shield corporate inboxes from marketing spam. While public 10-minute mail services exist, they present significant compliance and data privacy risks. Utilizing a public service means your sensitive activation codes, API tokens, and corporate correspondence pass through third-party servers.

The solution? Self-hosting your own disposable email service. By deploying Disposable-Mail on your own Virtual Private Server (VPS), you retain 100% ownership of your logs, data, and infrastructure. This comprehensive guide walks you through the technical process of establishing a self-hosted temporary email system tailored for enterprise or advanced personal use.

Why Self-Host Disposable-Mail?

Disposable-Mail is an open-source, lightweight, and modern temporary email solution. Opting to self-host this specific stack offers several distinct advantages over standard public alternatives:

  • Absolute Data Sovereignty: No third party can inspect, log, or monetize incoming emails.
  • Custom Domain Branding: Run your service on your own domain or subdomains (e.g., @temp.yourcompany.com).
  • Bypass Common Blocks: Many web services block standard temporary email domains. With a private domain, your success rate increases exponentially.
  • Cost Efficiency: Run the service on a minimal, cost-effective VPS alongside existing microservices.

Prerequisites and Technical Requirements

Before initiating the deployment process, ensure you have the following components ready:

  1. A Linux VPS: A server running Ubuntu 22.04 LTS or newer with at least 1GB RAM and a static IPv4 address.
  2. A Domain Name: Access to a domain registrar's DNS management console.
  3. Docker & Docker Compose: The modern standard for containerized deployment, ensuring a clean installation.
  4. Basic SSH Knowledge: Familiarity with navigating the Linux command line via terminal.

Step 1: Domain and DNS Configuration

Proper DNS routing is critical for any mail server. Without precise records, internet routers will fail to deliver emails to your VPS. Access your DNS provider (e.g., Cloudflare, Namecheap) and create the following essential records:

A Record (Server Pointing)

Create an A Record pointing your mail subdomain to your VPS IP address.

Host: mail.yourdomain.com
Value: YOUR_VPS_IP_ADDRESS
TTL: Automatic/Automatic

MX Record (Mail Exchange)

The MX Record tells the world where to send emails addressed to your domain.

Host: yourdomain.com (or temp.yourdomain.com)
Value: mail.yourdomain.com
Priority: 10

TXT Records (SPF for Authentication)

To prevent your server from being flagged as a spam vector and to allow proper routing verification, add an Sender Policy Framework (SPF) record:

Host: yourdomain.com
Value: v=spf1 mx a ip4:YOUR_VPS_IP_ADDRESS ~all

Step 2: Preparing the VPS Environment

Connect to your VPS via SSH and update the system packages to ensure stability and security:

sudo apt update && sudo apt upgrade -y

Next, install Docker and Docker Compose if they are not already present on your infrastructure:

sudo apt install docker.io docker-compose -y
sudo systemctl enable --now docker

Step 3: Deploying Disposable-Mail via Docker Compose

Create a dedicated directory to house your application configuration and navigate into it:

mkdir ~/disposable-mail && cd ~/disposable-mail

Create a docker-compose.yml file using your preferred text editor (such as nano):

version: '3.8'

services:
  disposable-mail:
    image: flashsc/disposable-mail:latest
    container_name: disposable-mail
    ports:
      - "80:80"    # Web GUI
      - "25:25"    # SMTP Port for receiving incoming mail
    environment:
      - DOMAIN=yourdomain.com
      - SERVER_IP=YOUR_VPS_IP_ADDRESS
    restart: always
    volumes:
      - ./data:/app/data

Note: Replace yourdomain.com and YOUR_VPS_IP_ADDRESS with your actual domain and VPS infrastructure details.

Launch the service in detached mode by executing the following command:

docker-compose up -d

Step 4: Securing the Installation and Firewall Setup

Security should never be an afterthought. Ensure your VPS firewall allows traffic on the required web and mail ports while blocking unauthorized vector attacks. If you are using UFW (Uncomplicated Firewall), execute the following configuration:

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 25/tcp
sudo ufw enable

Crucial Security Advisory: Ensure that your VPS provider does not block outbound or inbound port 25. Many providers block port 25 by default to mitigate spam. If your service fails to receive mail, contact your provider's support team to request unblocking port 25 for legitimate mail routing uses.

Step 5: Testing Your Private Disposable Email Service

Once the containers are operational, open a web browser and navigate to your server's domain or IP address. You will be greeted by the clean, intuitive Disposable-Mail Web Interface.

To verify that everything is operating within functional parameters, perform the following validation protocol:

  1. Click the "Generate" or "Random" button on your interface to spawn a temporary email address.
  2. Using an external, standard corporate or personal email account (such as Gmail or Outlook), draft an email and send it to the newly generated temporary address.
  3. Monitor the self-hosted dashboard. Within seconds, the incoming email should populate the web UI, complete with full text, formatting, and attachment capabilities.

Advanced Enhancements: SSL/TLS and Reverse Proxies

For enterprise-grade deployments, running your web interface over standard HTTP (Port 80) is highly discouraged. To protect your session tokens and interactions, it is recommended to implement an Nginx Reverse Proxy alongside Let's Encrypt SSL certificates.

By routing your traffic through Nginx and utilizing certbot, you ensure all user interaction with your disposable email dashboard is encrypted via HTTPS (Port 443), safeguarding internal business testing operations.

Conclusion

Setting up a self-hosted temporary email service using Disposable-Mail on a VPS provides a robust, private alternative to public tools. It grants complete sovereignty over your data, eliminates external tracking, and ensures reliable access for testing and secure registrations. By managing your own mail infrastructure, you establish a critical tool for privacy and security within your operational workflows.

Build Your Own Private Disposable Email Service: A Guide to Self-Hosting Disposable-Mail on a VPS | DPTCloud