0

I created a mail server (mail.mydomain.com) and can send emails from something@mydomain.com without any issue. But when some email addresses (which I tried to send email to) fail, bounce messages try to go to something@mail.mydomain.com and can't be delivered to me.

My current MX records:

            MX  mail.mydomain.com
    mail    MX  mail.mydomain.com

I use CentOS 7 x64, VestaCP, Exim and Dovecot.

How can i redirect all @mail.mydomain.com emails to @mydomain.com and let the server accept these emails?

Xel Naga
  • 103
  • 4
  • What distribution/OS are you using? – Piotr P. Karwasz Jan 04 '20 at 09:50
  • CentOS 7 x64 minimal + VestaCP – Xel Naga Jan 04 '20 at 09:51
  • What is the content of `domainlist` record? – Romeo Ninov Jan 04 '20 at 10:02
  • 2
    In general rather than setting up MX records for mail-or-other-host.example.com and accepting mail for that sub domain you try to ensure that messages don’t get sent with an email address user@mail-or-other-host.example.com but you configure either your mail sending application to explicitly use user@example.com and/or configure the SMTP server to force all addressing to user@example.com. See for instance https://serverfault.com/q/548826/546643 – Bob Jan 04 '20 at 10:10

1 Answers1

1

Regardless of your OS and mail-software, MX-records need to have a priority figure too.

For example, here the priority is set to 11:

@ IN MX 11 mail.example.com # MX-record for the domain itself
* IN MX 11 mail.example.com # MX-record for any hosts or subdomains

These will tell the rest of the Internet, whom to give e-mails sent to your domain (and any of the subdomains).

You will still need to configure the e-mail software on your computer(s) to handle such delivery attempts, but that's another topic.

Mikhail T.
  • 2,272
  • 1
  • 22
  • 49