Skip to content

aidooit/odoo_greenmail_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Odoo + GreenMail Docker Environment

A safe email testing sandbox for Odoo developers. No emails are ever sent to the real world - GreenMail intercepts everything locally.

Why Use This?

  • Test outgoing emails (quotations, invoices, notifications) without spamming real addresses
  • Simulate customer replies and verify they link to the correct Odoo records
  • Full email round-trip testing in an isolated environment
  • Pre-configured addon installs mail servers automatically

Repository Structure

├── docker-compose.yml          # Odoo 19 + PostgreSQL 17 + GreenMail
├── config/
│   └── odoo.conf               # Odoo configuration (SMTP pre-configured)
├── addons/
│   └── greenmail_demo/         # Demo addon with partners & mail servers
├── mail_client_example/        # FastAPI app to view/send GreenMail emails
└── docs/                       # Screenshots for documentation

Quick Start

Prerequisites

  • Docker and Docker Compose

Start the Environment

docker compose up -d

Access Points

Service URL Purpose
Odoo http://localhost:8069 Main application
GreenMail API http://localhost:8080 REST API for emails
Mail Client http://localhost:3000 Web UI for GreenMail (requires setup)

Mail Client Setup

Note: GreenMail does not include a built-in web interface - it only exposes a REST API at port 8080. The mail client included in this repository is a custom FastAPI application created specifically for this project to provide a convenient web UI for viewing and sending test emails.

Set up the mail client before proceeding to Odoo configuration:

cd mail_client_example
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn server:app --port 3000 --reload

Alternatively, run ./run.sh as a shortcut to uvicorn server:app --port 3000 --reload

Open http://localhost:3000

Features

  • View all mailboxes (auto-discovered from GreenMail)
  • Read emails with attachments
  • Send new emails
  • Reply to existing emails

Setup Walkthrough

Step 1: Install the GreenMail Demo Addon

Navigate to Apps in Odoo and install GreenMail Demo Setup.

Install GreenMail Demo

Step 2: Demo Contacts Created

The addon automatically creates demo contacts for testing.

Demo Contacts

Step 3: Configure Incoming Mail Server

Go to Settings → Technical → Incoming Mail Servers. The GreenMail IMAP server is pre-configured.

Incoming Mail Server

Step 4: Test and Confirm Incoming Server

Click Test & Confirm to verify the connection.

Test Incoming Server

Step 5: Configure Outgoing Mail Server

Go to Settings → Technical → Outgoing Mail Servers. The GreenMail SMTP server is pre-configured.

Outgoing Mail Server

Step 6: Test Connection (Initial Error)

The connection test will fail if the admin user has no email set.

Test Connection Error

Step 7: Set Admin User Email

Go to Settings → Users and set the admin email to test@example.com.

Set Admin Email

Step 8: Test Connection Success

Return to the outgoing mail server and test again. It should now succeed.

Test Connection Success

Step 9: GreenMail Client Ready

The mail client is ready to display intercepted emails.

GreenMail Client

Testing Email Flow

Step 1: Send an Email from Odoo

Create a quotation and send it by email.

Send Order by Email

Step 2: Email Received in GreenMail

The email appears in the GreenMail client (no real email sent).

Email in GreenMail

Step 3: Reply as Customer

Use the mail client to simulate a customer reply.

Customer Reply

Step 4: Run Fetchmail Cronjob

Go to Settings → Technical → Scheduled Actions and run the Fetchmail Service action.

Fetchmail Cronjob

Step 5: Reply Appears in Sale Order Chatter

The customer's reply is automatically linked to the original Sale Order.

Reply in Chatter

Why GreenMail is Safe

Feature Benefit
All emails trapped locally No external delivery, no accidental spam
Auto-creates accounts First email to any address creates that mailbox
Authentication disabled No setup needed for test credentials
In-memory storage All data cleared on container restart

GreenMail Ports Reference

Port Protocol Purpose
3025 SMTP Send emails
3110 POP3 Fetch emails (alternative)
3143 IMAP Fetch emails
3465 SMTPS Send emails (SSL)
3993 IMAPS Fetch emails (SSL)
3995 POP3S Fetch emails (SSL, alternative)
8080 HTTP REST API

Default Credentials

Service User Password
Odoo Admin admin (set on first launch)
PostgreSQL odoo odoo
GreenMail any any (auth disabled)

Demo Data

The greenmail_demo addon creates:

Summary

This environment provides a complete email testing sandbox for Odoo development. You can safely test outgoing emails, simulate customer replies, and verify that messages link correctly to Odoo records - all without any risk of sending emails to real addresses. GreenMail traps everything locally, making it ideal for development and QA workflows.

Warning: This setup is intended for development and testing only. Do not use GreenMail in production - emails are stored in memory and lost on restart, authentication is disabled, and there is no delivery to real mail servers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors