Professional email account management for Odoo 19 with docker-mailserver integration.
- Features
- Requirements
- Installation
- Configuration
- Usage
- API Reference
- Security
- Testing
- Troubleshooting
- Contributing
- License
- Email Account Management: Create, update, delete email accounts directly from Odoo
- Docker-mailserver Integration: Automatic postfix-accounts.cf configuration
- Secure Password Management: PBKDF2-SHA512 hashing, secure random generation
- User Integration: Link email accounts to Odoo users with automatic SMTP/IMAP setup
- Password Change Wizard: Secure two-step verification for mail password changes
- Activity Tracking: Full chatter integration with field tracking
- Multi-language: French translation included
- Enterprise Security: Atomic file operations, backup creation, rate limiting
- Odoo 19.0
- docker-mailserver (with shared volume for config files)
- Python packages:
passlib(included in Odoo)
# Mount the module in your docker-compose.yml
volumes:
- ./addons/mail_server_manager:/mnt/extra-addons/mail_server_manager# Copy to addons folder
cp -r mail_server_manager /path/to/odoo/addons/
# Update module list and install
odoo-bin -d your_database -u mail_server_managerNavigate to Settings → General Settings → Mail Server Manager:
| Setting | Description | Default |
|---|---|---|
| Mail Domain | Your email domain (e.g., company.com) | - |
| Config Path | Path to docker-mailserver config files | /etc/odoo/mail_config |
| SMTP Host | Outgoing mail server hostname | |
| IMAP Host | Incoming mail server hostname | |
| IMAP Port | IMAP SSL port | 993 |
| Auto-create | Create mailbox when creating Odoo user | False |
| Overwrite Email | Replace user's email with mail account | False |
- Go to Settings → Mail Server → Email Accounts
- Click Create to add a new email account
- Fill in the email address and optionally link to an Odoo user
- Click Activate to create the mailbox on the server
- Go to Preferences (user menu → My Profile)
- Find the Mail Server tab
- Click Change Password to update your mail password
- Enter your Odoo password for verification, then set new mail password
Main model for email accounts.
| Field | Type | Description |
|---|---|---|
email |
Char | Email address (unique, required) |
user_id |
Many2one | Linked Odoo user |
state |
Selection | draft, active, suspended, error |
quota_mb |
Integer | Mailbox quota in MB |
last_password_reset |
Datetime | Last password reset timestamp |
Methods:
action_reset_password()- Generate and set new random passwordaction_suspend()- Suspend the email accountaction_activate()- Activate/reactivate the accountaction_recover_from_error()- Recover from error stateaction_sync_from_server()- Import accounts from postfix-accounts.cf
AbstractModel providing configuration access.
| Method | Returns | Description |
|---|---|---|
_get_mail_domain() |
str | Configured mail domain |
_get_mail_config_path() |
str | Validated config path |
_get_smtp_host() |
str | SMTP server hostname |
_get_imap_host() |
str | IMAP server hostname |
_get_imap_port() |
int | IMAP port (default: 993) |
| Parameter | Description |
|---|---|
mail_server_manager.mail_domain |
Email domain |
mail_server_manager.config_path |
Docker config path |
mail_server_manager.smtp_host |
SMTP hostname |
mail_server_manager.imap_host |
IMAP hostname |
mail_server_manager.imap_port |
IMAP port |
mail_server_manager.auto_create |
Auto-create mailboxes |
- Password Hashing: PBKDF2-SHA512 with 600,000 iterations
- Email Validation: Strict regex pattern validation
- Path Traversal Prevention: Config path validation
- Rate Limiting: Maximum 3 password resets per hour per account
- Record Rules: Users can only view their own mail account
- Two-Step Verification: Odoo password required before mail password change
# Run all module tests
odoo-bin -d testdb -i mail_server_manager --test-enable --stop-after-init
# Run specific test class
odoo-bin -d testdb --test-tags mail_server_managerPassword verification fails:
- Ensure the user has a valid Odoo password set
- Check that PBKDF2-SHA512 hash format is correct in database
Mail account not syncing:
- Verify the config_path is accessible by Odoo
- Check file permissions on postfix-accounts.cf
IMAP/SMTP connection fails:
- Verify mail server hostname resolves correctly
- Check SSL/TLS certificates are valid
- Fork the repository
- Create a feature branch
- Write tests for new functionality
- Submit a pull request
This module is licensed under LGPL-3. See LICENSE for details.
KHALID SAHIH | Sudo System
Website: sudosystem.com
Email: khalid.sahih@sudosystem.com
GitHub: github.com/sudosystem-git