mail.mydomain.tld related questions

I’m trying to understand the structure and how all work together.

Whenever I create a new “website” the following happens (among others):

  • Created: /home/mydomain.tld/public_html (OK)
  • Created: /home/mydomain.tld/public_html/mail.mydomain.tld (NOT-OK)
  • And in DNS Zone Records the following exist:

A mail.mydomain.tld (OK)
A mail.mail.mydomain.tld (NOT-OK)
CNAME www.mail.mydomain.tld mail.mydomain.tld (NOT-OK)
MX mydomain.tld mail.mydomain.tld (OK)
MX mail.mydomain.tld mail.mail.mydomain.tld (NOT-OK)

So:
mail.mydomain.tld is created as a child website. If you write mail.mydomain.tld to your browser you get a welcome page as it has a vHost. As this is a website, it also has a recursive mail.mail.* …

Is this a bug, is this only related to my server or is it intended to work like this? If it is correct, can someone please explain me why do they exist? If not, how can I correct this?

Thank you in advance…

mail.domain.com is created for this reason → 6 - Self-signed SSL error on Outlook/Thunderbird - 06 - Email - CyberPanel Community

Because usually mail clients detect mail.domain.com as hostname while connecting.

@CyberPanel

Thank you, that explains it.

I know mail.* must be a subdomain. But it should not be served by the web server but dovecot - just saying without knowing the implementation.

In any case, with the current implementation, can I assume the following:

  1. I can delete the following without any problems:

A mail.mail.mydomain.tld (NOT-OK)
CNAME www.mail.mydomain.tld mail.mydomain.tld (NOT-OK)
MX mail.mydomain.tld mail.mail.mydomain.tld (NOT-OK)

  1. I should write some htaccess to return a “not allowed” code or put an emty index.html

Thank you again…

  1. Yes you can safely delete those.

  2. Yes upto you, but you can not delete mail.domain.com from child-domains because if you delete this child-domain its SSL will fail to renew thus causing problems.

Thank you, much clearer now.
Perhaps it is best not to create those extra DNS records during Website creation…

I mean something like that would solve it (pseudo code):

Option - 1 : Send a parameter to the subroutine

call createChildDomain(bool blCreateMail)

Option - 2 : Hardcoded

if (left(strChildDomainName, 5) != “mail.”) {
; do create DNS records

}

Will do

Awesome !

Tengo el mismo problema, quizás la idea de tener el registro mail.dominio.com es que puedes redirigir con el httacces al webmail para que sea fácil acceder al correo para los usuarios. También elimine el registro MX mail.mail.dominio que no tiene sentido. Aun no lo pruebo pero estoy en desarrollo, si tienen algún consejo les agradecería.