Disposable Email inbox with Docker
Comprehensive Guide to TempFastMail: A Self-Hosted, Temporary Email Service for Secure and Disposable Inbox Management
Introduction
In today’s digital age, where privacy concerns are increasingly prevalent, the need for secure and temporary email solutions has grown significantly. TempFastMail presents itself as a cutting-edge self-hosted disposable email service designed to provide users with an ephemeral inbox that automatically deletes sensitive messages after a specified period. Unlike traditional email providers that retain emails indefinitely or offer limited temporary storage, TempFastMail ensures data privacy by adhering to strict retention policies while offering a seamless user experience through Docker-based deployment.
This detailed guide explores the functionality, setup process, security features, and production deployment of TempFastMail, making it an ideal choice for developers, privacy-conscious individuals, and organizations requiring secure email handling. By leveraging modern containerization techniques with Docker Compose, TempFastMail simplifies the deployment process while maintaining high performance and reliability.
Core Features of TempFastMail
1. Self-Hosted Disposable Email Inbox
TempFastMail is a self-hosted solution, meaning users can deploy it on their own infrastructure without relying on third-party email providers. This approach eliminates concerns about data privacy, compliance with strict regulations like GDPR, and potential breaches from external servers.
The service allows users to receive emails in real-time while providing an admin interface for managing incoming messages. Unlike generic disposable email services that often lack customization options, TempFastMail integrates seamlessly into existing workflows by allowing users to configure their domain and API endpoints.
2. Temporary Email Storage with Automatic Deletion
One of the most critical features of TempFastMail is its adherence to a strict retention policy—emails are stored for up to 48 hours before being automatically deleted from the database. This ensures that sensitive information remains secure even if users forget to manually delete messages.
The admin interface provides additional control over email retention, allowing users to manually purge all emails at any time. This feature is particularly useful in scenarios where temporary credentials or one-time passwords need to be managed securely without leaving a permanent record.
3. Integration with Cloudflare Email Worker
TempFastMail enhances its functionality by integrating with Cloudflare’s Email Worker, a free service that processes incoming emails and forwards them to the TempFastMail instance. This integration simplifies the setup process, as users no longer need to manually configure email forwarding rules.
The Cloudflare Email Worker acts as an intermediary, ensuring that all incoming messages are securely routed to TempFastMail without exposing sensitive data to external systems. Users can customize the forwarding behavior based on their needs, making it a versatile solution for both personal and professional use cases.
4. Docker-Based Deployment for Easy Setup
TempFastMail leverages Docker Compose to streamline deployment, allowing users to set up the service in minutes with minimal technical expertise. The provided docker-compose.yml file contains all necessary configurations, including:
- Container Name:
tempfastmail - Image Source: A custom Docker image (
kasteckis/tempfastmail:latest) maintained by the project’s developer - Environment Variables:
CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEY– A randomly generated key for API authentication (users must replace this with a secure value)DEFAULT_URI– The domain where TempFastMail is hosted (must be replaced with the user’s actual domain)
By using Docker, TempFastMail ensures consistency across different environments—whether running on a local machine or a cloud server. This containerization approach also simplifies scaling and maintenance.
5. Secure Authentication & API Access
TempFastMail includes an authentication mechanism to control access to the admin interface and email management features. The CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEY environment variable ensures that only authorized users can interact with the service, reducing the risk of unauthorized access.
Users can log in using default credentials (admin@admin.dev with password admin), but it is strongly recommended to configure a custom API key for enhanced security. This approach aligns with modern security best practices, where API keys are used instead of hardcoded passwords.
Step-by-Step Setup Process
1. Prerequisites
Before deploying TempFastMail, users must ensure they have the following:
- A Docker and Docker Compose installed on their system.
- A domain name (e.g.,
yourdomain.com) for configuring theDEFAULT_URIenvironment variable. - Basic knowledge of SQLite databases, as TempFastMail uses SQLite to store emails.
2. Creating the Docker Compose Configuration File
The first step involves creating a docker-compose.yml file with the following structure:
services:
tempfastmail:
container_name: tempfastmail
image: kasteckis/tempfastmail:latest
environment:
CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEY: change-this-to-a-random-value
DEFAULT_URI: https://yourdomain.com
ports:
- "80:80"
volumes:
- ./sqlite:/app/sqlite
Key Configuration Details:
CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEY: Replacechange-this-to-a-random-valuewith a strong, randomly generated key. This ensures that only authorized users can access the admin interface.DEFAULT_URI: Set this to your domain (e.g.,https://tempfastmail.yourdomain.com). If deploying locally, you may need to adjust the port forwarding accordingly.- Volumes: The
./sqlite:/app/sqlitemapping ensures that emails are stored persistently in a SQLite database file located in the host’s current directory.
3. Generating a Random API Key
To enhance security, users should generate a strong random key for authentication. Tools like OpenSSL can be used to create a cryptographically secure token:
openssl rand -hex 16
This command generates a 32-character hexadecimal string that can be used as the CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEY.
4. Deploying TempFastMail with Docker Compose
After configuring the docker-compose.yml file, users can deploy TempFastMail using the following commands:
docker-compose pull
docker-compose up -d
This command pulls the latest image from Docker Hub and starts the container in detached mode (-d). Users should verify that the service is running by checking the logs:
docker-compose logs tempfastmail
5. Configuring Cloudflare Email Worker
To enable email forwarding, users must set up a Cloudflare Email Worker. The process involves:
- Creating an Email Worker in Cloudflare’s dashboard.
- Setting up a forwarding rule to route emails from the sender’s domain to TempFastMail.
- Configuring the worker to call TempFastMail’s API endpoint for processing.
The official documentation provides detailed instructions on setting up the Email Worker, ensuring that all incoming messages are securely forwarded to TempFastMail without exposing sensitive data.
6. Accessing the Admin Interface
Once deployed, users can access the TempFastMail admin interface by visiting:
https://yourdomain.com/admin
Default credentials (admin@admin.dev and admin) may be used initially, but it is recommended to log in via an API key for better security.
Security & Privacy Considerations
1. Automatic Email Deletion
One of TempFastMail’s most robust features is its 48-hour retention policy, ensuring that emails are automatically deleted after this period. This prevents accidental or intentional misuse while maintaining a balance between accessibility and privacy.
Users can also manually delete all emails from the admin interface, providing additional control over data retention.
2. Secure API Authentication
The use of an API_AUTHORIZATION_KEY ensures that only authorized users can interact with TempFastMail’s backend. This prevents unauthorized access to sensitive email data, reducing the risk of breaches.
3. Encrypted Communication (Optional)
While TempFastMail does not natively support HTTPS for all endpoints, users can enforce encryption by configuring their domain’s SSL/TLS settings. Cloudflare, for example, provides free SSL certificates that can be used to secure the entire service.
4. Database Security
TempFastMail stores emails in an SQLite database, which is stored within a Docker volume (./sqlite). This ensures that data persists even if the container restarts, but it also means that users must ensure their host system’s security is robust enough to prevent unauthorized access to the database file.
Production Deployment & Optimization
1. Building a Production-Ready Image
To deploy TempFastMail in production, users can build a custom Docker image with optimized settings:
docker build --target frankenphp_prod -t kasteckis/tempfastmail:latest .
docker push kasteckis/tempfastmail:latest
This command builds the image with production-specific configurations, ensuring better performance and security compared to the default development version.
2. Scaling & Performance
TempFastMail is designed to run efficiently within a single container, but users can scale it horizontally by deploying multiple instances behind a load balancer if needed. However, given its lightweight nature, most deployments will not require additional scaling.
3. Monitoring & Maintenance
Users should monitor the TempFastMail container’s logs for any errors or performance issues:
docker-compose logs -f tempfastmail
Regular backups of the SQLite database can be taken to ensure data integrity in case of unexpected failures.
Use Cases for TempFastMail
1. Privacy-Conscious Users
TempFastMail is ideal for individuals who want a secure, self-hosted email solution without relying on third-party providers. This is particularly useful for those concerned about data privacy and compliance with regulations like GDPR.
2. Developers & Test Environments
Developers often need temporary email addresses for testing APIs or setting up mock services. TempFastMail provides a reliable way to generate disposable emails without leaving permanent records.
3. Businesses Requiring Secure Credential Management
Companies that issue one-time passwords (OTPs) or temporary credentials can use TempFastMail to ensure that sensitive information is automatically deleted after use, reducing the risk of exposure.
4. Security Testing & Penetration Analysis
Security professionals may use TempFastMail to simulate email-based attacks or test their own systems for vulnerabilities in email handling processes.
Troubleshooting Common Issues
1. Connection Errors When Accessing Admin Interface
If users encounter connection issues, they should verify:
- The
DEFAULT_URIis correctly set to their domain. - Docker is running and the container is accessible via the specified port (
80). - Cloudflare’s Email Worker is properly configured to forward emails.
2. Missing Emails in the Inbox
If emails are not appearing, users should check:
- The Cloudflare Email Worker logs for forwarding errors.
- Whether the
CREATE_RECEIVED_EMAIL_API_AUTHORIZATION_KEYis correctly set and accessible. - That the Docker container is running without any permission issues.
3. Database Corruption or Performance Issues
If SQLite database corruption occurs, users can:
- Restart the container to rebuild the database.
- Manually back up and restore the
sqlitevolume if necessary.
Conclusion
TempFastMail represents a significant advancement in self-hosted disposable email solutions, combining ease of deployment with robust security features. By leveraging Docker Compose for seamless setup, Cloudflare’s Email Worker for secure forwarding, and an automatic 48-hour retention policy, TempFastMail provides users with a reliable way to manage temporary emails without compromising privacy.
Whether used for personal privacy, testing environments, or business credential management, TempFastMail offers a flexible and secure alternative to traditional disposable email services. Its open-source nature also allows developers to extend its functionality based on their specific requirements, making it a versatile tool in modern digital workflows.
For further assistance, users can refer to the project’s GitHub repository for detailed documentation or open an issue if they encounter any problems during deployment. The community support ensures that TempFastMail remains a reliable and evolving solution for secure email management.
Enjoying this project?
Discover more amazing open-source projects on TechLogHub. We curate the best developer tools and projects.
Repository:https://github.com/kasteckis/TempFastMail
GitHub - kasteckis/TempFastMail: Disposable Email inbox with Docker
TempFastMail is a self-hosted disposable email service that automatically deletes emails after 48 hours. It uses Docker Compose for deployment, integrates with ...
github - kasteckis/tempfastmail