Hi, i am new to mailcow, but a bit experienced with linux servers. I am not very familiar with docker. Can we use multiple domains, each with their MX record : mx.domain1.com, mx.domain2.net … ? I know i can use a single MX for all domains, but i would like to use separate MX for each domains. Is it that achievable somehow, using mailcow ?

  • mlcwuser replied to this.
  • Xerud es, for single MX i know it`s enough.

    You cannot use a single MX record. You have to add one MX record to each domain / zone file, but all of them should point to mail.domain1.tld, or whatever the FQDN of your mail server is.

    If the FQDN of your mail server is mail.domain1.tld, you would add the MX records as follows:

    $ORIGIN domain1.tld.
    @                       IN      MX      10 mail.domain1.tld.
    mail                    IN      A       <IP-ADDRESS>
    _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>
    
    $ORIGIN domain2.tld.
    @                       IN      MX      10 mail.domain1.tld.
    _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>
    
    $ORIGIN domain3.tld.
    @                       IN      MX      10 mail.domain1.tld.
    _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>

    As you can see, there are three MX records, one for each domain, but all of them are pointing to the FQDN of the mail server.

    Xerud One more question. How should i enter the TLSA record on second domains, if i use Cloudflare ? ?

    https://www.cloudns.net/wiki/article/342/

    Xerud or it`s enough if i add the record on the main domain that is also the FQDN for the server

    Yes, but you have to add it to all of your domains, just like the MX records.

    Xerud know i can use a single MX for all domains, but i would like to use separate MX for each domains

    Not a good idea, because the MX record for each domain should point to the FQDN (Fully Qualified Domain Name) of the mail server, which in turn should match the PTR (Reverse DNS) record.

    Is there a specific reason why you want to do this?

    Have something to say?

    Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

    esackbauer MX record is always per domain!

    You’re of course right, I think I misunderstood the original question.

    esackbauer They can however point to the same DNS name for the actual server.

    Afaik they actually have to if these domains are hosted on the same server/IP address. That was the point of my answer, although I don’t think that was what @Xerud had in mind. ;-)

    Yes, I just wanted to post the same 🙂
    I’m running a single mailcow with 15 different domains. Of course you have to setup your DNS zones for each domain to include the necessary entries (see link above) and have to make sure that you have a valid PTR entry for your mailcow’s IP address.
    I always use the mxtoolbox to verify my setup, i.e.:

    mxtoolbox.com Icon Email Server Test - Online SMTP diagnostics tool - MxToolbox

    The server is a Hetzner VPS, I can add multiple IP`s, that is not a problem. No specific reason, just used to use different MX for each domain, with some control panels i used for domains hosting, before switching to another panel ( cloudpanel from cloudpanel.io ), that has no mail server included, but runs pretty smoothly, and it is easy to host different types of sites and apps with it. Before switching to this panel i used alot of time hestiacp, and that panel used to create separate MX entries for each domain. That is the main reason i asked if it is possible.

    I’m also running a Hetzner Cloud VM for my mailcow. The main IP address is sufficient for as many domains as you desire 🙂 No need for multiple IPs

      Xerud Well, that depends on the mail volume I guess… it’s a CX41 in my case, serving mails for 15 domains in total

        DocFraggle i have a smaller one: CPX31 but i have only 5 domains. And only 2 domains generates more traffic. And i need one username ( mail account ) to send and receive mails for a booking laravel app, and the other one is a CRM that sends once an hour a report with incomes, new clients … the rest are more static mails, with use only very rare ocassions. But i have another server ( dedicated one, where i run cloudpanel ) to host sites and apps.

        One more question. How should i enter the TLSA record on second domains, if i use Cloudflare ? or it`s enough if i add the record on the main domain that is also the FQDN for the server ?

          Xerud Sorry, I can’t help with that, I don’t use TLSA

          Xerud es, for single MX i know it`s enough.

          You cannot use a single MX record. You have to add one MX record to each domain / zone file, but all of them should point to mail.domain1.tld, or whatever the FQDN of your mail server is.

          If the FQDN of your mail server is mail.domain1.tld, you would add the MX records as follows:

          $ORIGIN domain1.tld.
          @                       IN      MX      10 mail.domain1.tld.
          mail                    IN      A       <IP-ADDRESS>
          _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>
          
          $ORIGIN domain2.tld.
          @                       IN      MX      10 mail.domain1.tld.
          _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>
          
          $ORIGIN domain3.tld.
          @                       IN      MX      10 mail.domain1.tld.
          _25._tcp.mail		IN	TLSA	3 1 1 <HASH Value>

          As you can see, there are three MX records, one for each domain, but all of them are pointing to the FQDN of the mail server.

          Xerud One more question. How should i enter the TLSA record on second domains, if i use Cloudflare ? ?

          cloudns.net Icon ClouDNS: What is TLSA record?

          Xerud or it`s enough if i add the record on the main domain that is also the FQDN for the server

          Yes, but you have to add it to all of your domains, just like the MX records.

            mlcwuser but how to add it to all domains, because it will not reflect the records shown on the records ? on the records shown for the rest of domains the TLSA shows that the entry should be 25.tcp.mail.maindomain and on second second domain the 25.tcp.mail will point to second domain,not to primary, so the TLSA will look like this on second: 25.tcp.mail.domain2.tld, instead of 25.tcp.mail.domain1.tld as suggested on DNS configuration.

            You’re right, and you probably only need to add the TLSA for 25.tcp.mail.domain1. At least if you don’t pursue your original plan of multiple MX, and PTR records, on multiple IPs.

            I have it on all domains, because my SSL certificate actually contains all domains that are hosted on my server, in order to make the webui availabe on all domains, and for easy configuration of mail clients that don’t support autodiscovery. However I could probably delete the entries for my additional domains, because all external connections over port 25 are always using mail.domain1.tld, regardless of how the clients are connected to the server, and regardless which of the domains on the server is sending/reciving mails.

            But yeah, good question, actually, and I can’t give you a definitive answer. All I can say, that it works without issues for me.

            Maybe someone else here has more insight…

            No one is typing