Skip to content

Deploying Cypht

Cypht is a lightweight, fast, and secure webmail client that aggregates multiple email accounts from various providers (IMAP, POP3, JMAP) into a single, unified interface. Built with privacy and security in mind, Cypht provides a modern alternative to traditional webmail clients, allowing you to manage all your email accounts without giving a third party access to your credentials. The application features a modular architecture with support for RSS feeds, GitHub notifications, WordPress.com updates, and more, all accessible through a clean, responsive interface.

Unlike heavyweight email clients, Cypht is designed to be fast and resource-efficient while maintaining robust security features including end-to-end encryption support, two-factor authentication, and secure session management. It’s perfect for individuals and organizations looking for a self-hosted email solution that respects privacy and puts you in control of your data.

Why Deploy Cypht on Klutch.sh?

Klutch.sh provides an ideal platform for hosting Cypht with several advantages:

  • Simple Docker Deployment: Push your Dockerfile and Klutch.sh handles the rest, automatically detecting and deploying your container
  • Persistent Storage: Attach volumes to store email cache, user configurations, and attachments securely
  • Automatic HTTPS: All deployments come with automatic SSL certificates, ensuring secure email access
  • Resource Efficiency: Cypht’s lightweight design means lower hosting costs while maintaining excellent performance
  • Privacy Focus: Self-hosted on your infrastructure means complete control over your email data
  • Scalable Infrastructure: Easily adjust resources as your email storage needs grow

Prerequisites

Before deploying Cypht, ensure you have:

  • A Klutch.sh account (sign up at klutch.sh)
  • Git installed locally
  • Basic familiarity with Docker and email protocols (IMAP/SMTP)
  • Email account credentials from your provider(s)
  • Domain access for email configuration (optional but recommended)

Understanding Cypht’s Architecture

Cypht uses a modular architecture that separates concerns and allows for flexible configuration:

Core Components

PHP Application Layer: The main application is built with PHP and handles all email operations, user authentication, and module management. Cypht uses a session-based authentication system with support for two-factor authentication.

Email Protocol Handlers: Cypht supports multiple email protocols:

  • IMAP: For reading emails from your inbox
  • SMTP: For sending emails
  • POP3: Alternative protocol for retrieving emails
  • JMAP: Modern JSON-based email protocol

Module System: Cypht’s functionality is extended through modules that can be enabled or disabled:

  • Core modules (required): IMAP, SMTP, Account management
  • Optional modules: Calendar, Contacts, RSS feeds, GitHub, WordPress

Storage Layer: Cypht requires persistent storage for:

  • User configurations and settings
  • Email cache and attachments
  • Session data
  • Module data

Web Server: Typically served through Apache or Nginx with PHP-FPM for optimal performance.

Data Flow

  1. User authenticates through the web interface
  2. Cypht establishes connections to configured email accounts using IMAP/SMTP
  3. Email data is fetched, cached locally, and displayed in the unified interface
  4. All credentials are stored encrypted on the server
  5. Attachments and messages can be cached for offline access

Installation and Setup

Step 1: Create the Dockerfile

Create a Dockerfile in your project root. We’ll use Alpine Linux for a minimal footprint:

FROM php:8.2-apache-bullseye
# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libldap2-dev \
libicu-dev \
libcurl4-openssl-dev \
libonig-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
mysqli \
pdo \
pdo_mysql \
zip \
gd \
intl \
curl \
mbstring \
ldap \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /var/www/html
# Clone Cypht repository
RUN git clone --depth 1 https://github.com/cypht-org/cypht.git /tmp/cypht \
&& cp -r /tmp/cypht/* /var/www/html/ \
&& rm -rf /tmp/cypht
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader
# Create necessary directories
RUN mkdir -p /var/www/html/data \
/var/www/html/users \
/var/www/html/attachments \
&& chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
# Copy configuration
RUN cp /var/www/html/hm3.sample.ini /var/www/html/hm3.ini
# Configure Apache
RUN a2enmod rewrite headers ssl \
&& sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
# Set proper permissions
RUN chown -R www-data:www-data /var/www/html
# Expose port
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \
CMD curl -f http://localhost/ || exit 1
# Start Apache
CMD ["apache2-foreground"]

Step 2: Create Configuration File

Create a hm3.ini configuration file to customize Cypht’s behavior:

; Cypht Configuration File
; This file should be mounted to /var/www/html/hm3.ini
; Database settings (optional - SQLite used by default)
; db_driver=mysql
; db_host=mysql-host
; db_name=cypht
; db_user=cypht_user
; db_pass=secure_password
; Authentication settings
auth_type=DB
default_setting_no_password_save=true
enable_2fa=true
; Session settings
session_type=file
session_lifetime=43200
session_key=CHANGE_THIS_TO_A_RANDOM_STRING
; Email settings
allow_external_image_sources=false
smtp_auth=true
imap_per_page=50
; Module settings
; Comma-separated list of enabled modules
modules=core,imap,smtp,account,contacts,calendar,profiles,settings,themes
; Security settings
disable_origin_check=false
allow_long_session=false
encrypt_ajax_requests=true
encrypt_local_storage=true
; File paths
attachment_dir=/var/www/html/attachments
user_config_dir=/var/www/html/users
data_dir=/var/www/html/data
; Timezone
default_timezone=UTC
; Interface settings
default_language=en
enable_themes=true
default_theme=blue
; Performance settings
enable_memcached=false
enable_redis=false

Step 3: Create Docker Compose for Local Development

Create a docker-compose.yml file for local testing:

version: '3.8'
services:
cypht:
build: .
ports:
- "8080:80"
volumes:
- cypht-data:/var/www/html/data
- cypht-users:/var/www/html/users
- cypht-attachments:/var/www/html/attachments
- ./hm3.ini:/var/www/html/hm3.ini:ro
environment:
- PHP_MEMORY_LIMIT=256M
- PHP_UPLOAD_MAX_FILESIZE=25M
- PHP_POST_MAX_SIZE=25M
restart: unless-stopped
volumes:
cypht-data:
cypht-users:
cypht-attachments:

Step 4: Initialize Git Repository

Terminal window
git init
git add Dockerfile hm3.ini docker-compose.yml
git commit -m "Initial Cypht deployment configuration"

Step 5: Test Locally

Before deploying to Klutch.sh, test your configuration locally:

Terminal window
# Build and start the container
docker-compose up -d
# Check logs
docker-compose logs -f
# Access Cypht at http://localhost:8080

Deploying to Klutch.sh

Step 1: Push to GitHub

Create a new repository on GitHub and push your code:

Terminal window
git remote add origin https://github.com/yourusername/cypht-klutch.git
git branch -M master
git push -u origin master

Step 2: Connect Repository to Klutch.sh

  1. Navigate to klutch.sh/app
  2. Click "New Project" and select "Import from GitHub"
  3. Authorize Klutch.sh to access your GitHub repositories
  4. Select your Cypht repository from the list
  5. Klutch.sh will automatically detect the Dockerfile in your repository

Step 3: Configure Traffic Settings

  1. In the project settings, select **HTTP** as the traffic type
  2. Set the internal port to **80** (matching the EXPOSE directive in the Dockerfile)
  3. Klutch.sh will automatically provision an HTTPS endpoint for your application

Step 4: Add Persistent Storage

Cypht requires persistent volumes for storing user data, configurations, and email cache:

  1. In your project settings, navigate to the "Storage" section
  2. Add a volume with mount path: `/var/www/html/data` and size: `5GB` (for application data)
  3. Add a volume with mount path: `/var/www/html/users` and size: `2GB` (for user configurations)
  4. Add a volume with mount path: `/var/www/html/attachments` and size: `10GB` (for email attachments)

Storage recommendations:

  • Data volume: Start with 5GB, scale based on cache size
  • Users volume: 2GB is typically sufficient for user configurations
  • Attachments volume: 10GB+ depending on expected attachment storage

Step 5: Configure Environment Variables

Add the following environment variables in your Klutch.sh dashboard:

  • PHP_MEMORY_LIMIT: 256M
  • PHP_UPLOAD_MAX_FILESIZE: 25M
  • PHP_POST_MAX_SIZE: 25M

Step 6: Deploy

  1. Review your configuration settings
  2. Click "Deploy" to start the deployment process
  3. Klutch.sh will build your Docker image and deploy the container
  4. Monitor the build logs for any errors
  5. Once deployed, your application will be available at `your-app.klutch.sh`

Getting Started with Cypht

Initial Setup

After your first deployment, you’ll need to complete the initial setup:

  1. Access Your Instance: Navigate to https://your-app.klutch.sh

  2. Create Admin Account: On first launch, Cypht will prompt you to create an administrator account:

    • Enter a username (email address recommended)
    • Create a strong password
    • Confirm the password
    • Submit to create your account
  3. Log In: Use your newly created credentials to log in

Adding Your First Email Account

Once logged in, you can add email accounts:

  1. Click on "Settings" in the main menu
  2. Navigate to "E-mail Accounts"
  3. Click "Add Account"
  4. Select the account type (IMAP/SMTP)
  5. Enter your email account details: - **IMAP Server**: imap.gmail.com (for Gmail) - **IMAP Port**: 993 - **IMAP Security**: SSL/TLS - **Username**: your.email@gmail.com - **Password**: Your app password (for Gmail, generate at Google App Passwords)
  6. Configure SMTP settings for sending: - **SMTP Server**: smtp.gmail.com - **SMTP Port**: 587 - **SMTP Security**: STARTTLS - **Username**: your.email@gmail.com - **Password**: Same app password
  7. Click "Save" to test and save the configuration

Common Email Provider Settings

Gmail

IMAP Server: imap.gmail.com
IMAP Port: 993
IMAP Security: SSL/TLS
SMTP Server: smtp.gmail.com
SMTP Port: 587
SMTP Security: STARTTLS
Note: Enable 2FA and generate an app password

Outlook/Office 365

IMAP Server: outlook.office365.com
IMAP Port: 993
IMAP Security: SSL/TLS
SMTP Server: smtp.office365.com
SMTP Port: 587
SMTP Security: STARTTLS

Yahoo Mail

IMAP Server: imap.mail.yahoo.com
IMAP Port: 993
IMAP Security: SSL/TLS
SMTP Server: smtp.mail.yahoo.com
SMTP Port: 465 or 587
SMTP Security: SSL/TLS

ProtonMail Bridge

IMAP Server: 127.0.0.1
IMAP Port: 1143
IMAP Security: STARTTLS
SMTP Server: 127.0.0.1
SMTP Port: 1025
SMTP Security: STARTTLS
Note: Requires ProtonMail Bridge running locally

Configuring Multiple Accounts

Cypht’s strength lies in aggregating multiple email accounts:

  1. Add Multiple Accounts: Repeat the email account setup process for each email provider
  2. Unified Inbox: All accounts appear in a unified “Everything” folder
  3. Account Filtering: Use the left sidebar to filter by specific accounts
  4. Combined Search: Search across all configured accounts simultaneously

Customizing Your Interface

Personalize your Cypht experience:

  1. Themes: Navigate to Settings → Themes to change the color scheme
  2. Language: Select your preferred language in Settings → General
  3. Display Options: Configure message preview, reading pane layout, and list density
  4. Notification Settings: Enable desktop notifications for new messages

Enabling Additional Modules

Cypht supports various optional modules:

  1. Navigate to Settings → Modules
  2. Browse available modules: - **Calendar**: Manage events and appointments - **Contacts**: Store and organize contacts - **RSS Feeds**: Add RSS/Atom feeds to your unified interface - **GitHub**: Monitor GitHub notifications - **WordPress**: Track WordPress.com updates
  3. Toggle modules on/off as needed
  4. Configure module-specific settings in their respective sections

Production Best Practices

Security Hardening

  1. Strong Session Keys: Update the session_key in your hm3.ini with a strong random string:
session_key=YOUR_VERY_LONG_RANDOM_STRING_HERE_AT_LEAST_32_CHARS

Generate a secure key:

Terminal window
openssl rand -base64 32
  1. Two-Factor Authentication: Enable 2FA for all user accounts:
enable_2fa=true
  1. HTTPS Only: Ensure your deployment uses HTTPS (automatic with Klutch.sh):
disable_origin_check=false
encrypt_ajax_requests=true
encrypt_local_storage=true
  1. Secure Headers: Add security headers to your Apache configuration by creating a custom security.conf:
<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'"
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
</IfModule>

Update your Dockerfile to include this configuration:

COPY security.conf /etc/apache2/conf-available/security.conf
RUN a2enconf security

Database Configuration

For production deployments with multiple users, consider using MySQL/MariaDB instead of SQLite:

  1. Deploy a Database: Create a separate MySQL deployment on Klutch.sh or use an external database service

  2. Update Configuration: Modify your hm3.ini:

db_driver=mysql
db_host=mysql.example.com
db_port=3306
db_name=cypht
db_user=cypht_user
db_pass=secure_database_password
  1. Create Database Schema: Cypht will automatically create necessary tables on first launch

Backup Strategy

Implement regular backups of your persistent volumes:

  1. User Data: Schedule backups of /var/www/html/users (contains encrypted credentials and settings)
  2. Email Cache: Backup /var/www/html/data (can be regenerated but saves time)
  3. Attachments: Backup /var/www/html/attachments (important for stored files)

Create a backup script:

#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backups/cypht_$DATE"
mkdir -p $BACKUP_DIR
cp -r /var/www/html/users $BACKUP_DIR/
cp -r /var/www/html/data $BACKUP_DIR/
cp -r /var/www/html/attachments $BACKUP_DIR/
cp /var/www/html/hm3.ini $BACKUP_DIR/
tar -czf $BACKUP_DIR.tar.gz $BACKUP_DIR
rm -rf $BACKUP_DIR
# Keep only last 30 days of backups
find /backups -name "cypht_*.tar.gz" -mtime +30 -delete

Performance Optimization

  1. Enable Caching: For better performance with multiple users, enable Redis or Memcached:

Add Redis to your deployment:

# In your Dockerfile or as a separate service
RUN apt-get update && apt-get install -y redis-server

Update hm3.ini:

enable_redis=true
redis_host=localhost
redis_port=6379
  1. PHP Optimization: Adjust PHP settings for better performance:

Create php-custom.ini:

memory_limit = 256M
upload_max_filesize = 25M
post_max_size = 25M
max_execution_time = 300
max_input_time = 300
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60

Update Dockerfile:

COPY php-custom.ini /usr/local/etc/php/conf.d/custom.ini
  1. Apache Tuning: Optimize Apache for email workloads:

Create apache-custom.conf:

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>

Monitoring and Logging

  1. Enable Logging: Configure comprehensive logging in hm3.ini:
enable_logging=true
log_level=INFO
log_file=/var/www/html/data/cypht.log
  1. Health Checks: The Dockerfile includes a health check that monitors Apache status. Monitor this in your Klutch.sh dashboard.

  2. Email Monitoring: Track email connection issues:

    • Monitor IMAP/SMTP connection failures
    • Set up alerts for authentication errors
    • Track attachment storage usage

Resource Allocation

Recommended resources based on usage:

Light Use (1-5 users, 2-3 accounts each):

  • Memory: 512MB - 1GB
  • CPU: 0.5 - 1 vCPU
  • Storage: 20GB

Medium Use (5-20 users, multiple accounts):

  • Memory: 1GB - 2GB
  • CPU: 1 - 2 vCPU
  • Storage: 50GB

Heavy Use (20+ users, extensive attachments):

  • Memory: 2GB - 4GB
  • CPU: 2 - 4 vCPU
  • Storage: 100GB+

Troubleshooting

Cannot Connect to Email Server

Symptoms: Error message “Cannot connect to IMAP/SMTP server” when adding an account

Possible Causes:

  • Incorrect server settings or credentials
  • Email provider blocking connections
  • Firewall issues

Solutions:

  1. Verify Server Settings: Double-check the IMAP/SMTP server addresses and ports

    Terminal window
    # Test IMAP connection
    openssl s_client -connect imap.gmail.com:993 -crlf
    # Test SMTP connection
    openssl s_client -connect smtp.gmail.com:587 -starttls smtp
  2. Check Email Provider Security Settings:

    • For Gmail: Enable “Less secure app access” or use app passwords with 2FA
    • For Outlook: Ensure IMAP is enabled in settings
    • For Yahoo: Generate an app password
  3. Verify Credentials: Ensure username (usually full email) and password are correct

  4. Check Logs: Review Cypht logs for detailed error messages:

    Terminal window
    tail -f /var/www/html/data/cypht.log

Emails Not Syncing

Symptoms: New emails don’t appear or sync is very slow

Solutions:

  1. Check IMAP Cache Settings: In Settings → E-mail, adjust cache refresh interval:

    imap_per_page=50
    imap_max_range=5000
  2. Clear Cache: Delete cache files to force refresh:

    Terminal window
    rm -rf /var/www/html/data/imap_cache/*
  3. Verify Account Status: Ensure the email account is still active and not locked

  4. Check Connection Limits: Some providers limit concurrent IMAP connections

Attachment Upload Fails

Symptoms: Unable to attach files to emails or uploads fail

Solutions:

  1. Check PHP Limits: Verify PHP upload settings:

    upload_max_filesize = 25M
    post_max_size = 25M
    memory_limit = 256M
  2. Verify Volume Permissions: Ensure the attachments directory is writable:

    Terminal window
    chown -R www-data:www-data /var/www/html/attachments
    chmod -R 755 /var/www/html/attachments
  3. Check Storage Space: Verify your volume hasn’t reached capacity in the Klutch.sh dashboard

Session Timeout Issues

Symptoms: Frequently logged out or session expires quickly

Solutions:

  1. Increase Session Lifetime: Update hm3.ini:

    session_lifetime=43200 # 12 hours in seconds
    allow_long_session=true
  2. Check Session Storage: Ensure session directory is writable:

    Terminal window
    chown -R www-data:www-data /var/www/html/data/sessions
  3. Clear Old Sessions: Remove expired session files:

    Terminal window
    find /var/www/html/data/sessions -type f -mtime +1 -delete

Database Connection Errors

Symptoms: “Could not connect to database” error messages

Solutions:

  1. Verify Database Credentials: Check hm3.ini settings:

    db_driver=mysql
    db_host=your-mysql-host
    db_name=cypht
    db_user=cypht_user
    db_pass=your_password
  2. Test Database Connection: Connect manually to verify:

    Terminal window
    mysql -h your-mysql-host -u cypht_user -p cypht
  3. Check Database Permissions: Ensure the user has proper privileges:

    GRANT ALL PRIVILEGES ON cypht.* TO 'cypht_user'@'%';
    FLUSH PRIVILEGES;

High Memory Usage

Symptoms: Application becomes slow or crashes due to memory limits

Solutions:

  1. Increase PHP Memory: Update environment variable in Klutch.sh:

    PHP_MEMORY_LIMIT=512M
  2. Optimize Cache Settings: Reduce cache size in hm3.ini:

    imap_max_range=1000
    imap_per_page=25
  3. Enable External Caching: Use Redis to offload memory:

    enable_redis=true
  4. Scale Resources: Increase allocated memory in your Klutch.sh project settings

Advanced Configuration

Custom Domain Setup

To use your own domain with Cypht:

  1. Add Custom Domain: In your Klutch.sh project settings, add your custom domain

  2. Configure DNS: Add a CNAME record pointing to your Klutch.sh deployment:

    mail.yourdomain.com CNAME your-app.klutch.sh
  3. SSL Certificate: Klutch.sh automatically provisions SSL certificates for custom domains

LDAP Authentication

Integrate with your organization’s LDAP directory:

  1. Enable LDAP Module: Install PHP LDAP extension (already included in our Dockerfile)

  2. Configure LDAP: Update hm3.ini:

    auth_type=LDAP
    ldap_host=ldap.yourdomain.com
    ldap_port=389
    ldap_base_dn=dc=yourdomain,dc=com
    ldap_user_dn=ou=users,dc=yourdomain,dc=com
    ldap_bind_dn=cn=admin,dc=yourdomain,dc=com
    ldap_bind_password=your_ldap_password
    ldap_user_filter=(uid=%s)
  3. Test LDAP Connection: Verify users can authenticate against your LDAP server

S3 Storage for Attachments

For large-scale deployments, store attachments in S3-compatible storage:

  1. Install S3 Module: Add AWS SDK to your Dockerfile:

    RUN composer require aws/aws-sdk-php
  2. Configure S3: Create custom Cypht module or use external storage service

  3. Update Configuration: Set attachment storage to S3:

    attachment_storage=s3
    s3_bucket=cypht-attachments
    s3_region=us-east-1
    s3_access_key=YOUR_ACCESS_KEY
    s3_secret_key=YOUR_SECRET_KEY

Webhook Integration

Set up webhooks for real-time notifications:

  1. Enable Webhook Module: Add to enabled modules in hm3.ini:

    modules=core,imap,smtp,account,webhooks
  2. Configure Webhook Endpoints: Create webhook configuration file:

    config/webhooks.php
    <?php
    return [
    'new_message' => 'https://your-webhook-service.com/new-email',
    'login_event' => 'https://your-webhook-service.com/login',
    ];
  3. Test Webhooks: Send test events to verify integration

Multi-Domain Support

Support multiple email domains in a single instance:

  1. Configure Virtual Hosts: Not applicable for Cypht (single instance handles all domains)

  2. Domain-Specific Settings: Users can add accounts from any domain through the interface

  3. Branding Per Domain: Customize themes and logos based on user’s primary domain

Calendar and Contact Sync

Enable calendar and contact synchronization with external services:

  1. Enable Modules:

    modules=core,imap,smtp,account,calendar,contacts,caldav,carddav
  2. Configure CalDAV: Add CalDAV server in Settings → Calendar:

  3. Configure CardDAV: Add CardDAV server in Settings → Contacts:

  4. Sync Schedule: Configure automatic sync intervals in module settings

RSS Feed Integration

Add RSS feeds to your unified inbox:

  1. Enable RSS module in Settings → Modules
  2. Navigate to Settings → RSS Feeds
  3. Click "Add Feed"
  4. Enter feed URL (e.g., https://news.ycombinator.com/rss)
  5. Configure update frequency
  6. RSS items appear alongside emails in your unified inbox

GitHub Notifications

Monitor GitHub activity within Cypht:

  1. Enable GitHub module in Settings → Modules
  2. Navigate to Settings → GitHub
  3. Generate a GitHub Personal Access Token at github.com/settings/tokens
  4. Enter your GitHub username and token
  5. Select repositories to monitor
  6. GitHub notifications appear in your unified inbox

API Access

Cypht doesn’t have a built-in REST API, but you can extend it:

  1. Create API Module: Develop a custom module for API endpoints
  2. Authentication: Use OAuth2 or API keys for authentication
  3. Endpoints: Expose common operations (send email, fetch messages, etc.)

Example API endpoint structure:

modules/api/handler.php
<?php
class Hm_Handler_api_send_email extends Hm_Handler_Module {
public function process() {
// Validate API key
$api_key = $this->request->header['X-API-Key'];
if (!$this->validate_api_key($api_key)) {
return json_encode(['error' => 'Unauthorized']);
}
// Send email logic
$to = $this->request->post['to'];
$subject = $this->request->post['subject'];
$body = $this->request->post['body'];
// Use Cypht's SMTP module to send
return json_encode(['success' => true]);
}
}

Additional Resources

Conclusion

Cypht provides a powerful, privacy-focused solution for managing multiple email accounts through a single, unified interface. By deploying on Klutch.sh, you benefit from automatic HTTPS, persistent storage, and simple Docker-based deployment without sacrificing control over your email data.

The lightweight architecture and modular design make Cypht suitable for both personal use and small team deployments. With support for IMAP, SMTP, POP3, and JMAP protocols, you can aggregate accounts from virtually any email provider while maintaining end-to-end security.

Whether you’re looking to consolidate personal email accounts, set up a team email solution, or provide self-hosted webmail for your organization, Cypht on Klutch.sh offers the flexibility, security, and performance you need. Start with the basic configuration outlined in this guide, then expand functionality through modules and custom configurations as your requirements grow.

Your email data remains under your control, connections are encrypted, and the open-source nature of Cypht means you can audit, modify, and extend the platform to meet your exact needs. Deploy Cypht today and take control of your email experience.