External mail servers feature - New implementation

  • Dear users,


    A new implementation of the external mail servers feature for i-MSCP has been integrated to the master branch. Feel free to test it and to report any bug you can found onto our bug tracker.


    This new implementation fixes all issues reported in #447 (including a critical bug described in #503)).


    The technical information for the new implementation are the following:


    Options for entries related to external mail servers of a domain (therefore also domain alias) :


    I. Without any external mail server entry (Implemented)


    • We add the default DNS MX entry for the domain and all its subdomains
    • We add an entry for the domain and all its subdomains in the Postfix virtual_mailbox_domains map


    This is the default behavior of i-MSCP.


    II. For an external mail server responsible to manage mail of domain (excluding its subdomains) (Not Implemented Yet)


    • We remove the default DNS MX entry for the domain
    • We remove the domain entry from the Postfix virtual_mailbox_domains map
    • We add a domain entry in the Postfix relay_domains map


    Note: We keep the subdomain entries in the Postfix virtual_mailbox_domains map since the default i-MSCP mail host will continue to handle mail for them.


    III. For an external mail server responsible to manage mail of domain (including its subdomains) (Implemented)


    • We remove the DNS MX entry for the domain
    • We remove the DNS MX entries for the subdomains
    • We remove the domain entry from the Postfix virtual_mailbox_domains map
    • We remove the subdomain entries from the Postfix virtual_mailbox_domains map
    • We add a domain entry to the Postfix relay_domains map (will also match subdomains)


    This is the option called Domain in the external mail servers interface.


    IV. For an external mail server responsible to manage mail of inexistent subdomains (not defined in the domain DNS zone file) (Implemented)


    • We add a DNS wildcard MX entry such as '*.domain.tld. IN MX 10 external.mail.host.tld.' (will be the MX answer for all inexistent subdomains only)
    • We add a specific entry (such as '.domain.tld OK') in the Postfix relay_domains map (only if this option is not mixed with III)


    This is the option called Wildcard in the external mail servers interface.


    Note: We keep the default entries for the domain and subdomains as provided by i-MSCP in the Postfix virtual_mailbox_domains map (default configuration) since an MX wildcard is only there to define a mail host responsible to handle mail for inexistent subdomains (subdomains not defined in the zone file). Of course, this assumption is made on the fact that only the wildcard option is used. The situation can diverge if we are mixing options.


    [hr]


    Note: In a near future, we will also implement the per subdomain external mail server option.


    [hr]


    About update:


    All DNS MX records related to external mail servers are automatically converted during update. If you have defined any CNAME records via the old external mail servers interface, you will have to re-add them by using the custom DNS interface since for technical reasons, they are simply removed during update. Also the external_mail_dns_ids field of both the domain and domain_aliasses tables will be synchronized automatically on next change via the external mail servers interface and so, you should not be worried about any orphaned id caused by CNAME records deletion.


    [hr]


    Acknowledgments


    I would like particularly thank Arthur Mayer (flames) that helped me a lot about technical aspects for implementation along this last week.


    Cheers

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

    Edited once, last by Nuxwin ().