# Can't send mails from one to another server

**URL:** <https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049>\
**Category:** Virtualmin\
**Created:** [November 4, 2020, 10:19am UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049 "2020-11-04T10:19:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nipec](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@Nipec](https://forum.virtualmin.com/u/Nipec)\
**Post date:** [November 4, 2020, 10:19am UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049/1 "2020-11-04T10:19:58Z")

</div>

**Operating system: Debian**  
**OS version: 9**

We have two servers running on virtualmin. Some time ago we made a change regarding the hostnames. Before the change we used two different domains for the servers and everything was working fine. Now the first server is named _first.webrex.host_ and the second one _second.werex.host_. After this modification, we can’t send mails from _first.webrex.host_ to _second.werex.host_ anymore (the other way around is still working). On _second.webrex.host_ there is a virtual host named [3w4you.net](http://3w4you.net) with mail enabled. If we send a mail from _first.webrex.host_ to a mailbox of this virtual host, we receive the following error per mail:

> The mail system [office@3w4you.net](mailto:office@3w4you.net): Host or domain name not found. Name service error for name=second.webrex.host type=AAAA: Host not found

In the logs I could only find this warning:

> Oct 13 20:06:59 first postfix/smtp[9890]: warning: no MX host for [3w4you.net](http://3w4you.net) has a valid address record

Restricting postfix to ipv4 only didn’t bring a change and the DNS records are also correct. I think the issue is related to the postfix configuration because the problem occured first after changing the hostnames.

postconf -n shows the following output:

> postconf: warning: /etc/postfix/master.cf: undefined parameter: mua\_sender\_restrictions  
> postconf: warning: /etc/postfix/master.cf: undefined parameter: mua\_client\_restrictions  
> postconf: warning: /etc/postfix/master.cf: undefined parameter: mua\_helo\_restrictions  
> alias\_database = hash:/etc/aliases  
> alias\_maps = hash:/etc/aliases  
> allow\_percent\_hack = no  
> append\_dot\_mydomain = no  
> biff = no  
> broken\_sasl\_auth\_clients = yes  
> compatibility\_level = 2  
> home\_mailbox = Maildir/  
> inet\_protocols = all  
> mailbox\_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME  
> mailbox\_size\_limit = 0  
> message\_size\_limit = 15728640  
> milter\_default\_action = accept  
> milter\_protocol = 2  
> mydestination = $myhostname localhost.$mydomain localhost  
> mydomain = webrex.host  
> myhostname = first.webrex.host  
> mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128  
> mynetworks\_style = subnet  
> myorigin = /etc/mailname  
> non\_smtpd\_milters = inet:localhost:8891  
> readme\_directory = no  
> recipient\_delimiter = +  
> sender\_bcc\_maps = hash:/etc/postfix/bcc  
> smtp\_tls\_security\_level = dane  
> smtp\_tls\_session\_cache\_database = btree:${data\_directory}/smtp\_scache  
> smtpd\_banner = $myhostname ESMTP $mail\_name (Debian/GNU)  
> smtpd\_milters = inet:localhost:8891  
> smtpd\_recipient\_restrictions = permit\_mynetworks permit\_sasl\_authenticated reject\_unauth\_destination  
> smtpd\_relay\_restrictions = permit\_mynetworks permit\_sasl\_authenticated defer\_unauth\_destination  
> smtpd\_sasl\_auth\_enable = yes  
> smtpd\_sasl\_security\_options = noanonymous  
> smtpd\_tls\_CAfile = /etc/postfix/postfix.ca.pem  
> smtpd\_tls\_cert\_file = /etc/postfix/postfix.cert.pem  
> smtpd\_tls\_key\_file = /etc/postfix/postfix.key.pem  
> smtpd\_tls\_mandatory\_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1  
> smtpd\_tls\_security\_level = may  
> smtpd\_tls\_session\_cache\_database = btree:${data\_directory}/smtpd\_scache  
> smtpd\_use\_tls = yes  
> virtual\_alias\_maps = hash:/etc/postfix/virtual

I’m thankful for any advice.

---

<div class="post-metadata">

**Author:** ![calport](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/calport/32/44_2.png) [@calport](https://forum.virtualmin.com/u/calport)\
**Post date:** [November 4, 2020, 10:53am UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049/2 "2020-11-04T10:53:58Z")

</div>

> [@Nipec](#):
>
> Oct 13 20:06:59 first postfix/smtp[9890]: warning: no MX host for [3w4you.net](http://3w4you.net) has a valid address record

You need to start here.

| Pref | Hostname | IP Address | TTL | |
| --- | --- | --- | --- | --- |
| 5 | [second.webrex.host](https://mxtoolbox.com/SuperTool.aspx?action=a%3a3w4you.net&run=toolpage#) | [78.46.83.201](https://mxtoolbox.com/SuperTool.aspx?action=a%3a3w4you.net&run=toolpage#) | | |

With Virtualmin, one normally points the MX to mail.domain.tld.

---

<div class="post-metadata">

**Author:** ![Nipec](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@Nipec](https://forum.virtualmin.com/u/Nipec)\
**Post date:** [November 5, 2020, 10:55am UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049/3 "2020-11-05T10:55:59Z")

</div>

> [@calport](#):
>
> With Virtualmin, one normally points the MX to mail.domain.tld.

What you describe was also the way we were doing it before. We copied the certificate of second.webrex.host to postfix and dovecot. Postfix was using then the certificate of second.webrex.host and in mail user agents the host was set to mail.domain.tld. This led to a certificate domain mismatch so we decided to use second.webrex.host as SMTP and IMAP host directly instead of mail.domain.tld, which would point to the same IP anyways. The mail-subdomain was then superfluous so we removed this DNS record for all virtual hosts and we set the MX record for all virtual hosts on second.webrex.host to second.webrex.host. We were doing the same thing for virtual hosts on first.webrex.host. Can you explain me why this wouldn’t work? I mean we can send mails from second.webrex.host to first.webrex.host and on the latter one we have the exact same configuration. Shouldn’t it work the other way around too?

---

<div class="post-metadata">

**Author:** ![calport](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/calport/32/44_2.png) [@calport](https://forum.virtualmin.com/u/calport)\
**Post date:** [November 5, 2020, 3:19pm UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049/4 "2020-11-05T15:19:23Z")

</div>

> [@Nipec](#):
>
> Can you explain me why this wouldn’t work?

No, I shall not explain on these forums why that does not work. All I will do is tell you that Virtualmin expects MX to point to mail.domain.tld and if you follow that convention then your two Virtualmin servers will be able to send email to each other normally.

I am available for private consultation and as remote system admin at a very reasonable rate of USD 25 per hour. I could discuss this with you professionally but on these forums your particular situation does not apply to how the larger community uses Virtualmin so I shall not discuss it further, please.

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [December 5, 2020, 3:19pm UTC](https://forum.virtualmin.com/t/cant-send-mails-from-one-to-another-server/108049/5 "2020-12-05T15:19:23Z")

</div>

Closed on December 5, 2020, 3:19pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
