which mail server to host in ubuntu which has imap and I can make its emails via cmd or…
- User
which mail server to host in ubuntu which has imap and I can make its emails via cmd or api
- 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
- 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 (
adduseretc.).
- Links:
- 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/
- 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/
- 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:
Setup IMAP Support API/CLI Account Management Complexity Postfix + Dovecot (virtual users via MySQL) Yes Manage users via SQL commands or scripts; create your API Moderate Zimbra Yes CLI ( zmprov) + SOAP/REST APIHigh iRedMail Yes SQL + iRedAdmin API Moderate Mailcow (Docker) Yes REST API + Web interface Moderate; needs Docker
Brief installation pointers for basic Postfix + Dovecot with virtual users:
- Install required packages:
sudo apt update sudo apt install postfix dovecot-imapd dovecot-pop3d dovecot-mysql mysql-server-
Setup MySQL database to hold virtual domains and users.
-
Configure Postfix to use the virtual mailbox database.
-
Configure Dovecot to authenticate virtual users against the database and serve IMAP.
-
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!
- Dovecot (for IMAP + POP3) + Postfix (for SMTP)