OdooWiki OCA HUB

Mail tracking for Mailgun

mail_tracking_mailgun folder_open OCA/mail open_in_new
Social Network License: AGPL-3

This module integrates mail_tracking events with Mailgun webhooks.

Mailgun is a service that provides an e-mail sending infrastructure through an SMTP server or via API. You can also query that API for seeing statistics of your sent e-mails, or provide hooks that processes the status changes in real time, which is the function used here.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Connect Odoo to Mailgun so sent emails are tracked automatically: delivery, opens, clicks, bounces and spam complaints are recorded, and you can check or force a contact's email status from the partner form.

This module links Odoo's email tracking with the Mailgun sending service. Once you enter your Mailgun keys in Settings, Odoo can register Mailgun webhooks so that status changes of sent emails (delivered, opened, clicked, unsubscribed, complained, failed, rejected) are imported automatically into the mail tracking records.

Where it appears: - Settings: a Mailgun section with fields for the API key, webhook signing key, validation key, API endpoint, domain and webhooks domain, plus buttons to register or unregister Mailgun webhooks. - Contact form: a Mailgun area with buttons to check the email against Mailgun's bounce list, check email validity, set bounced and unset bounced. - Email tracking form: a 'Re-sync Mailgun' button to fetch events again from the Mailgun API for that message.

Business rules and automatic behaviour: - Incoming Mailgun events are matched to the right Odoo database and tracking record; duplicates are ignored thanks to a unique Mailgun event ID. - Webhook calls are rejected if too old, already processed, or with a wrong signature. - When an email bounces, a message is posted on the contact's record with the reason and event. - Checking validity marks the contact as bounced and posts a warning when the address is invalid or fails mailbox verification.

It touches mail.tracking.email, mail.tracking.event, res.partner, res.config.settings and the outgoing mail server.

Depends on

Models and fields (4)
  • res.partner · extends an existing model
  • mail.tracking.email · extends an existing model
  • mail.tracking.event · extends an existing modelmailgun_id (Mailgun Event ID)
  • res.config.settings · extends an existing modelmail_tracking_mailgun_domain (Mailgun domain), mail_tracking_mailgun_api_key (Mailgun API key), mail_tracking_mailgun_api_url (Mailgun API endpoint), mail_tracking_mailgun_enabled (Enable mail tracking with Mailgun), mail_tracking_mailgun_validation_key (Mailgun validation key), mail_tracking_mailgun_webhooks_domain (Mailgun webhooks domain), mail_tracking_mailgun_webhook_signing_key (Mailgun webhook signing key)

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 8 confirmed, 1 with no information of 9 versions.

terminal Installation and usage

OCA documentation · Odoo 19.0

If you're using a multi-database installation (with or without dbfilter option) where /web/databse/selector returns a list of more than one database, then you need to add mail_tracking_mailgun addon to wide load addons list (by default, only web addon), setting --load option.

Example: --load=web,mail_tracking,mail_tracking_mailgun

To configure this module, you need to:

  • Go to Mailgun, create an account and validate your sending domain.
  • Go back to Odoo.
  • Go to Settings \> General Settings \> Discuss \> Enable mail tracking with Mailgun.
  • Fill all the values. The only one required is the API key.
  • Optionally click Unregister Mailgun webhooks and accept.
  • Click Register Mailgun webhooks.

You can also config timeout for mailgun with this system parameter:

  • mailgun.timeout: Set it to a number of seconds.

In your mail tracking status screens (explained on module mail_tracking), you will see a more accurate information, like the 'Received' or 'Bounced' status, which are not usually detected by normal SMTP servers.

It's also possible to make some checks to the partner's email addresses against the Mailgun API:

  • Check if the partner's email is in Mailgun's bounced list.
  • Check the validity of the partner's mailbox.
  • Force the partner's email into Mailgun's bounced list or delete from it.

It's also possible to manually check a message mailgun tracking when the webhook couldn't be captured. For that, go to that message tracking form, press the button Check Mailgun. It's important to note that tracking events have quite a short lifespan, so after 24h they won't be recoverable.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.