Can't create two MX records for a domain with email forwarding

aseering

New Member
I would like to have multiple MX records for my domain, pointing to different servers so that mail fails over if the primary is offline. One of those hosts is at a residential address so is listening on a non-standard port, so I'd like to use e-mail forwarding.

When I go into the UI, Zoneedit lets me create two MX records. However, whenever I update the hostname of one record, the other is automatically updated as well.

This used to work fine prior to my adding the host that required e-mail forwarding. But if I delete the MX record with the nonstandard port, even if I delete all MX records for this domain, the problem persists. I've also noticed that, when I create different records, they all route through a forwarding host (even those which could connect directly). Which I guess is fine, but it's unnecessary.

Is there a way for me to set this up? If not, is there at least a way for me to revert to my previous setup, with no mail forwarding but that supported multiple MX records correctly?
 

zesupport

Moderator
Staff member
Hello, this is odd sounding behavior in the editor. Can I ask you to be more specific? Please let us know your domain name and what records you are trying to enter
 

zeadmin

Administrator
Staff member
We were able to add the requested MX records for your domain name. Note that the old editor was used to do this, so this may have been a bug with the new editor. I've passed on the issue to our Dev team for further investigation.
 

aseering

New Member
Hm... Now my e-mail isn't getting delivered at all.

I've reverted the record to its previous state using the new interface. Now messages are being delivered to one of the servers, which is a start.

I assume something's misconfigured somewhere, either with the DNS records or with the mail servers on my end. Is there a way for me to access the old editor, to try playing around with these settings?
 

zeadmin

Administrator
Staff member
Yes you can access the old editor by selecting 'DNS Settings' under the 'Domains' menu. I've attached a screenshot.
 

Attachments

  • Screen Shot 2024-03-27 at 9.24.18 AM.png
    Screen Shot 2024-03-27 at 9.24.18 AM.png
    41.6 KB · Views: 3

aseering

New Member
Ooh thanks, that's helpful!

I've dug a bit deeper into this. Follow-on question: Is mail forwarding known to work with nonstandard ports?

I tried configuring an MX record as `<servername>:25`. This appears to cause the MX record to point at Zoneedit's mail server. When I then send mail to an address on that server, it gets delivered to the server via Zoneedit's forwarding.

I then tried pointing the same MX record at `<servername>:2525`, which my mail server is also configured to listen on. In this case, the actual MX record continues to point at Zoneedit's mail server, but when I send mail to it, the mail isn't delivered, and my mail server's log doesn't indicate anything trying to connect to it. I then tried telnet'ing manually to port 2525 on <servername> from another computer, connecting over the public Internet. I'm able to connect, so, it's not a firewall issue blocking the port; and I see the connection in my server log, so this is further than Zoneedit's servers are getting (because I don't see any connections in the log other than my telnet connection).

I've tried the same experiment with two separate hostnames pointed at two separate servers with different configurations. Same results. (If you can see my account, you can tell which ones -- they're the only two MX records currently pointing at port 2525.)

This would seem to imply to me that mail forwarding can't forward on ports other than 25. Is that a correct understanding?
 

Chris Cherry

Zoneedit Support
Hello,

It is recommended that you use a subdomain record for the MX (instead of the root domain), for example, "mail.servername.tld:2525". You will also need to make an additional A Record for that subdomain and point that to your mail server's IP Address.

The problem with using the root domain is that email of any sort, including port forwarding, is dependent on the MX for the zone it's forwarding to. So the MX for servername.tld has to point to our mx-caprica.zoneedit.com server so that we can receive an email for that zone to be able to forward it in the first place. However, since that is the case when trying to forward mail for servername.tld to servername.tld:2525, it looks to the MX of servername.tld when sending the mail and finds mx-caprica, our server. It then tries to connect to itself on port 2525 and fails. Basically, if you point the MX for servername.tld to servername.tld:2525, it creates a loop, and the email is not delivered.
 

aseering

New Member
Thanks for the reply! This was really helpful.

With regular mail forwarding, if I want an e-mail address `mail@A.example.com` to be delivered to a mail server with hostname `B.example.com`, I need an A record for `B.example.com` and a MX record for `A.example.com` pointing to `B.example.com`. With mail forwarding, as you say above, it seems that I additionally need an A record for `A.example.com`. I didn't have one; that was part of my issue.

(I was also assuming that the port-based forwarding was handled using `B.example.com`'s A record, since MX records aren't supposed to be chainable. But since it's really an SMTP server under the hood, it makes sense that it uses the MX record if one is present.)
 

aseering

New Member
One last problem (I hope!):

I have things working if I have a single MX record for a mail-forwarding domain, forwarding to a single mail host. However, I actually have two mail hosts. (One uses port 25; the other has a different hostname/IP and uses port 2525.) If one is offline, I want mail to get routed to the other.

If I create two records in the UI both with PRIO 5 (required for mail forwarding), I get a single MX record. It seems to pick a server; if that server is offline, it queues messages and doesn't try to deliver to the other server.

If I create two records one with PRIO 5 (for the port 2525 server) and one with some other PRIO value (for the port 25 server), I see two MX records in DNS, but both point to ZoneEdit servers. Mail is routed to the server with the lowest PRIO in its record. If that server is offline, mail queues at ZoneEdit and doesn't fail over to my other server.

Is there a way for me to configure two MX records for a hostname where one is forwarded and the other is not? That way I could have the port-25 server tried first; if it's offline, it can fail over to the forwarding server (which will presumably either successfully forward or queue the message).
 

Chris Cherry

Zoneedit Support
The default for mail systems is port 25, which means you don't need to set the mail server as "mail.yourdomain.tld:25" - leave it as "mail.yourdomain.tld". Anytime you add a ":####" after the hostname, it automatically assumes you are using our MX Port forwarding service.


This is how I would try setting it up with the first record pointing directly to your mail server, while the second one would come to us for MX port forwarding.

MX RECORDS:

Host: @
Mail Server: mail.yourdomain.tld
Pref: 1

Host: @
Mail Server: your.differenthostname.tld:2525
Pref: 5


In the above scenario, I believe it will queue up the email on our server and try to deliver it to mail.yourdomain.tld - so it would queue up until the primary is back online.
 

aseering

New Member
Thanks -- yes, I've tried this (omitting the `:25`). In this case, I would expect the resulting MX query for my domain to return two records -- one referring to `mail.yourdomain.tld` at prio 1 and one referring to `mx-something.zoneedit.com` at prio 5.

However, that's not what happens. As long as I specify the port for _at least one_ MX records for a given domain, then _all_ MX records show up to DNS queries as `mx-something.zoneedit.com`. Even if only one entry specifies a port and the rest omit the port.
 

Chris Cherry

Zoneedit Support
Right, it does appear to be doing that. It must be done purposefully or in a required way to avoid conflict. At this point, disregard my previous post, as it doesn't appear that it will work the way I thought it might.

However, the MX port forwarding would be a backup MX since it would queue up emails (for about 4-5 days) until your primary host is back online.
 

aseering

New Member
Thanks, makes sense.

Hm, then I guess I'm stuck here. I've tried a couple things:

- Create two MX records, one with mail forwarding and one without. This doesn't work because the record without mail forwarding gets converted to use mail forwarding (even though it doesn't need to do so), and then the message queues going to the first server rather than failing over and routing to the second server.

- Create an MX record to do mail forwarding, then create two A records, one for each mail server. This also doesn't seem to work: It picks one mail host and, if that one is offline, the forwarding server queues the message without trying the other mail host.

Does this all mean that there's no way to do what I want to do with Zoneedit currently? It seems like all of the pieces are here; it seems like there ought to be some clever way to configure them?
 

aseering

New Member
Wait, no, I made a silly typo, actually this one does work:

> - Create an MX record to do mail forwarding, then create two A records, one for each mail server. This also doesn't seem to work: It picks one mail host and, if that one is offline, the forwarding server queues the message without trying the other mail host.

The problem is, it's two A records, but the servers have dynamic IP addresses. (If I had static IPs, port 25 probably wouldn't be blocked :) ) Zoneedit's dynamic-DNS API appears designed to set "the IP address" for a hostname -- I'm not sure how to pass in multiple IP addresses to create multiple records? Does Zoneedit have a way to do this? Maybe a more-generic API of some sort so I could write up a simple script to fetch the IPs of the two servers and update the corresponding A (or DYN) records if the IPs have changed?
 

Chris Cherry

Zoneedit Support
You can write something to update the dynamic DNS hostnames with IP addresses. Just make sure their updates are 10+ minutes apart.
 

aseering

New Member
I need a single hostname that has two associated IP addresses. Not two separate hostnames with separate IP addresses. How can I do that with the dynamic DNS API?
 

Chris Cherry

Zoneedit Support
Understood. Unfortunately, the Dynamic DNS updater will not handle two IPs on one hostname.
 
Top