Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

which mail server to host in ubuntu which has imap and I can make its emails via cmd or…

  1. User

    which mail server to host in ubuntu which has imap and I can make its emails via cmd or api

  2. Assistant

    If you're looking to host a mail server on Ubuntu that supports IMAP and allows you to create/manage email accounts via command line or API, here are some common and well-supported options:


    Recommended Mail Server Stacks with IMAP Support on Ubuntu

    1. Dovecot (for IMAP + POP3) + Postfix (for SMTP)
      • Purpose: Postfix handles sending emails (SMTP), Dovecot handles mail delivery and IMAP/POP3.
      • IMAP Support: Dovecot is a very popular, secure IMAP server.
      • Account management: Depends on how you configure mail users; if you use system users or virtual users stored in a database (e.g., MySQL), you can add users via command line or scripts.
      • How to add email accounts:
        • If virtual users are stored in a database, manage users by querying/modifying the database (SQL queries via CLI or API).
        • If system users, add users via standard Linux user management commands (adduser etc.).
      • Links:

    1. Zimbra Collaboration Suite (Open Source Edition)
      • A more full-featured mail server with webmail, calendar, contacts, and IMAP.
      • Has an admin CLI (zmprov) and SOAP/REST APIs to create/manage accounts.
      • Heavyweight compared to Postfix+Dovecot, but built-in tools for account management.
      • Supports native IMAP.
      • Website: https://www.zimbra.com/open-source-email-server/

    1. iRedMail
      • An easy-to-install mail server suite that bundles Postfix, Dovecot, SpamAssassin, etc.
      • Supports virtual users in a database.
      • You can add users via database commands or iRedAdmin panel (which has API capabilities).
      • Website: https://www.iredmail.org/

    1. Mailcow: Docker-based mail suite
      • Modern mail server stack built using Docker containers.
      • Full IMAP/SMTP support with Postfix and Dovecot.
      • Provides API and web admin for managing users and domains.
      • Requires Docker, but very easy to deploy and manage.
      • Website: https://mailcow.email/

    For Your Specific Need: Create Emails via CLI/API + IMAP Support

    Best lightweight and flexible approach: Postfix + Dovecot with virtual users stored in a database (MySQL/PostgreSQL).

    • You can programmatically create email accounts by inserting records into the virtual user tables.
    • Email clients will use Dovecot for IMAP access.
    • You can script everything via CLI or call your own API that manipulates users in the database.

    Summary / Quick Recommendations:

    SetupIMAP SupportAPI/CLI Account ManagementComplexity
    Postfix + Dovecot (virtual users via MySQL)YesManage users via SQL commands or scripts; create your APIModerate
    ZimbraYesCLI (zmprov) + SOAP/REST APIHigh
    iRedMailYesSQL + iRedAdmin APIModerate
    Mailcow (Docker)YesREST API + Web interfaceModerate; needs Docker

    Brief installation pointers for basic Postfix + Dovecot with virtual users:

    1. Install required packages:
    sudo apt update
    sudo apt install postfix dovecot-imapd dovecot-pop3d dovecot-mysql mysql-server
    
    1. Setup MySQL database to hold virtual domains and users.

    2. Configure Postfix to use the virtual mailbox database.

    3. Configure Dovecot to authenticate virtual users against the database and serve IMAP.

    4. Create email users by inserting entries into the MySQL virtual users mailboxes table.


    If you want, I can provide sample configurations or scripts for this setup.


    Would you like me to provide:

    • Detailed steps to set up Postfix + Dovecot with virtual users on Ubuntu?
    • Example commands/scripts to create email accounts via database CLI?
    • Info on installing Zimbra or Mailcow?

    Let me know!