mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-25 00:46:03 +03:00
[GH-ISSUE #3944] Relative MX records produce false "Domain has no MX record" alarms #1940
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1940
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @utdream on GitHub (Feb 25, 2026).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/3944
Impacted versions
Steps to reproduce
Add a domain that uses Cloudflare and a relative mail server name (e.g. "mail" instead of "mail.domain.org")
Performing a "dig" on a domain with a relative MX record like this results in the "mail." domain being returned, which is also what Python gets in Modoboa's code.
Current behavior
All of my domains had relative domains in their MX records in Cloudflare. Cloudflare returns these relative domains with dots at the end (e.g. "mail.") which generally indicates a FQDN, but in reality it is a relative domain when entered into Cloudflare's UI.
When adding a domain configured in this way into Modoboa, its python code has trouble properly resolving these URL's, and raises false alarms of "Domain has no MX record".
I tracked this down to
/srv/modoboa/env/lib/python3.12/site-packages/modoboa/admin/lib.pywhere it doesget_domain_mx_list()and strips the trailing dot (line 257). It then tries to resolve the singular "mail" domain, which of course doesn't resolve, silently errors, then results in the false alarm.The temporary fix is to use a FQDN in your MX record (e.g. "mail.domain.org" instead of just "mail") and Modoboa will resolve it properly.
Expected behavior
Seeing as the "mail." record is indeed a proper MX record and that mail continues to work with this DNS set up, I believe the most resilient solution is for Modoboa to also be able to resolve this kind of DNS MX record. Perhaps a secondary function where if the first attempt to resolve fails, then Modoboa tries to resolve it as a relative domain instead of a FQDN? So, try first as a standard FQDN then if that produces no results, try alternatively as a relative DNS entry.