Table of Contents
- System Requirements
- Installation
- Configuration
- Using the Tool
- Features Overview
- Troubleshooting
- Security Considerations
System Requirements
Before installing the Mailcow Import Export Tool, ensure your system meets the following requirements:
- PHP Version: 7.4 or higher
- Mailcow: Working Mailcow installation with API access enabled
- Web Server: Apache, Nginx, or similar with PHP support
- Extensions: PHP cURL extension enabled
- Permissions: Write access to the installation directory
- API Access: Valid Mailcow API key with appropriate permissions
Installation
Step 1: Download and Extract
- Download the Mailcow Import Export Tool package from your account
- Extract the ZIP file to a temporary location
- You should see the following file structure:
mailcow-import-export/ ├── index.php ├── export.php ├── mailbox_import.php ├── domain_import.php ├── domain.php ├── outbound.php ├── sync.php ├── includes/ │ ├── config.php │ └── functions.php ├── css/ │ ├── custom.css │ └── mailcow-darkmode.css └── README.md
Step 2: Upload Files
- Upload all files to your web server
- Choose a directory that's accessible via web browser but secure
- Recommended locations:
/var/www/html/mailcow-tools/
/home/user/public_html/admin/mailcow/
- Or any subdirectory on your domain
Step 3: Set Permissions
Ensure proper file permissions are set:
# Set directory permissions
chmod 755 /path/to/mailcow-tools/
# Set file permissions
chmod 644 /path/to/mailcow-tools/*.php
chmod 644 /path/to/mailcow-tools/includes/*.php
chmod 644 /path/to/mailcow-tools/css/*.css
# Make sure the web server can read the files
chown -R www-data:www-data /path/to/mailcow-tools/
Configuration
Step 1: Obtain Mailcow API Key
- Log into your Mailcow admin interface
- Navigate to System > Configuration > API
- Enable API access if not already enabled
- Generate a new API key or use an existing one
- Copy the API key - you'll need it for configuration
Step 2: Configure the Tool
Edit the includes/config.php
file with your specific settings:
<?php
// includes/config.php
// Base URL of the Mailcow instance (no trailing slash)
$mailcow_base_url = 'https://mail.yourdomain.com';
// Mailcow API key with appropriate permissions
$mailcow_api_key = 'YOUR_API_KEY_HERE';
// Password to protect access to the tool
$password_protect = 'YOUR_SECURE_PASSWORD_HERE';
// Optional: Site name for branding
$site_name = 'Mailcow Management Tools';
// Optional: Base URL for magic links (if using Fail2ban manager)
$site_base_url = 'https://tools.yourdomain.com';
?>
Step 3: Configuration Parameters Explained
$mailcow_base_url
: The full URL to your Mailcow instance (without trailing slash)$mailcow_api_key
: Your Mailcow API key with read/write permissions$password_protect
: A strong password to protect access to the tool$site_name
: Optional branding for the tool interface$site_base_url
: Base URL for generating links (used in some features)
Step 4: Test Installation
- Navigate to your tool URL in a web browser
- You should see a login screen requesting the password
- Enter the password you configured in
$password_protect
- If successful, you'll see the main tool interface
Using the Tool
Main Interface
The tool provides a tabbed interface with the following sections:
- Import Mailcow Aliases - Bulk import email aliases
- Export Mailcow Aliases - Export existing aliases to CSV
- Import Mailcow Mailboxes - Bulk import mailboxes
- Import Mailcow Domains - Bulk import domains
- Domain Analyzer - Analyze and troubleshoot domains
- Outbound Monitor - Monitor outbound email activity
- Sync Manager - Synchronize and maintain consistency
Importing Aliases
Method 1: Manual Entry
- Click on Import Mailcow Aliases
- Select Manual Entry radio button
- Fill in the alias email and recipient email fields
- Click Add Another Alias to add more entries
- Click Submit to process
Method 2: Bulk CSV Import
- Select Bulk Upload via Text radio button
- Paste CSV data in the format:
alias1@yourdomain.com,recipient1@yourdomain.com alias2@yourdomain.com,recipient2@yourdomain.com alias3@yourdomain.com,recipient3@yourdomain.com
- Click Submit to process all entries
Exporting Aliases
- Navigate to Export Mailcow Aliases
- Select export criteria (domain, date range, etc.)
- Choose export format (CSV recommended)
- Click Export to download the file
Importing Mailboxes
- Go to Import Mailcow Mailboxes
- Prepare CSV data with columns:
username,password,domain,quota,active user1,SecurePass123,yourdomain.com,5120,1 user2,AnotherPass456,yourdomain.com,2048,1
- Paste data or upload CSV file
- Configure default settings (quota, active status)
- Click Import to process
Importing Domains
- Navigate to Import Mailcow Domains
- Prepare domain list or CSV with domain configurations
- Set default parameters (quota limits, relay settings)
- Submit for processing
Domain Analyzer
- Go to Domain Analyzer
- Enter domain name to analyze
- Review DNS records, MX records, and configuration
- Check for common issues and misconfigurations
- Follow recommendations for fixes
Outbound Monitor
- Access Outbound Monitor
- Review outbound email statistics
- Check for spam complaints or delivery issues
- Monitor sending reputation and patterns
Sync Manager
- Open Sync Manager
- Compare local and remote configurations
- Identify inconsistencies
- Apply synchronization fixes as needed
Features Overview
Security Features
- Password Protection: All access requires authentication
- Session Management: Secure session handling
- API Key Protection: Secure storage and transmission of API credentials
- Input Validation: All user inputs are validated and sanitized
Data Management
- CSV Import/Export: Standard CSV format support
- Bulk Operations: Process hundreds of entries at once
- Manual Entry: Single-entry forms for individual items
- Data Validation: Automatic validation of email addresses and domains
User Interface
- Responsive Design: Works on desktop and mobile devices
- Dark Mode Support: Automatic dark theme detection
- Real-time Feedback: Instant success/error messages
- Progress Indicators: Visual feedback during bulk operations
Troubleshooting
Common Installation Issues
Problem: "Permission denied" errors Solution:
chmod 755 /path/to/tool/
chown -R www-data:www-data /path/to/tool/
Problem: "API connection failed" Solution:
- Verify
$mailcow_base_url
is correct - Check API key has proper permissions
- Ensure Mailcow API is enabled
Problem: "Password authentication failed" Solution:
- Verify
$password_protect
in config.php - Clear browser cache and cookies
- Check for typos in password
Common Usage Issues
Problem: CSV import fails Solution:
- Check CSV format matches expected columns
- Ensure no special characters in email addresses
- Verify domains exist in Mailcow before adding aliases
Problem: Slow performance with large imports Solution:
- Process in smaller batches (50-100 entries)
- Check server resources (CPU, memory)
- Increase PHP execution time limits
Problem: Some aliases not importing Solution:
- Check for duplicate email addresses
- Verify domain exists and is active
- Review error messages for specific failures
Debug Mode
To enable debug mode for troubleshooting:
- Edit
includes/config.php
- Add:
$debug_mode = true;
- Check detailed error logs in browser console
Security Considerations
Best Practices
- Strong Passwords: Use complex passwords for
$password_protect
- HTTPS Only: Always access the tool over HTTPS
- IP Restrictions: Consider restricting access by IP address
- Regular Updates: Keep the tool updated to latest version
- API Key Security: Regularly rotate Mailcow API keys
Access Control
Consider implementing additional security measures:
// Add to config.php for IP restrictions
$allowed_ips = ['192.168.1.100', '10.0.0.50'];
$client_ip = $_SERVER['REMOTE_ADDR'];
if (!in_array($client_ip, $allowed_ips)) {
die('Access denied');
}
File Security
Protect sensitive files with .htaccess
:
# Place in includes/ directory
<Files "config.php">
Order Allow,Deny
Deny from all
</Files>
Support and Updates
Getting Help
- Check the troubleshooting section above
- Review error messages carefully
- Submit support tickets through your account
- Include relevant log files and error messages
Version Updates
- Backup your current installation
- Download the latest version
- Replace files except
includes/config.php
- Test functionality after update
- Review changelog for new features
Backup Recommendations
- Backup
includes/config.php
before updates - Export important data before major changes
- Keep backups of CSV import files
- Document custom configurations
This guide covers the essential aspects of installing, configuring, and using the Mailcow Import Export Tool. For additional support or specific use cases, please contact our support team.