0

I have been testing SMTP and its related DNS register, but I already tested it and what I have achieved is be able to send emails from the same email account (user@mydomain.com) from different servers, configuring the domain's DNSs like this:

mydomain.com
A   | mail         | points to *vps 1 ip addr*
A   | mail2        | points to *vps 2 ip addr*
A   | pop          | points to *vps 1 ip addr*
MX  | mydomain.com | mail handled by mail.mydomain.com (priority 10)
MX  | mydomain.com | mail handled by mail2.mydomain.com (priority 20)
TXT | _domainkey   | t=y; o=~;
TXT | mydomain.com | v=spf1 a mx ip4: *vps 1 ip addr* ?all
TXT | mydomain.com | v=spf1 a mx ip4: *vps 2 ip addr* ?all

I can even log in both account from clients like thunderbird and apparently everything works fine, but only one server can receive mails (it's obvious I guess, and I think it depends of priority set in MX records, couldn't test it yet).

So I stopped exim service from vps1 and tried to send a email expecting that would be sent to vps2 since vps1 wouldn't respond, but the sender never tried to send it to vps2...

Is possible to configure it in any way vps2 would receive mails just in case vps1 doesn't response?

I'm using exim under VestaCP in both servers

PD: I just realized that I've not set any register like pop pointing to my vps2

New post: Exim dnslookup, priority and “blacklist” (not really blacklist)

  • 1
    If you're really got MX records set up as shown in your question, then the sender should try mail.mydomain.com first, and if that is not available fall back to mail2.mydomain.com. I trust you have checked that both systems really are offering public SMTP service. – roaima Oct 3 '16 at 15:04
  • @roaima yes, these are exactly my records, and last weak mails were sent to vps1, today is vps2 which receive mails, don't get why... vps1 still set with lower priority number (which afaik it means higher priority). – Mc Kernel Oct 3 '16 at 15:52
  • @roaima about the SMTP service... I'm the owner of both vps and I setted it up in almost virgin servers, but as I said, I'm newbie at all related with SMTP, but well, both servers can send mails and eventually receive them – Mc Kernel Oct 3 '16 at 15:53
  • @roaima there is a 3rd vps where I send the mails and if I check exim's log I just see "Connection refused" (after stopping exim service in the main vps), apparently it's not trying to send mail to the secundary vps when the main vps is off, instead, mails just stay en queue till I turn main vps on :/ – Mc Kernel Oct 3 '16 at 15:55
  • No... "Connection refused" means there's nothing listening. – roaima Oct 3 '16 at 17:13
0

Unless you back the storage with a common file system, email will be delivered to one host or the other. Unless you want to read every email twice, you should not try to get email delivered to multiple systems. See What is the proper DNS setup for some details on DNS configuration.

You can send mail from user@example.com from anywhere. However, if you are sending to other servers it may get flagged as spam. You can use /etc/email-aliases to change the source address on your servers.

You should try to have one primary MX server to which mail flows from external servers. If you have a secondary server, it should eventually send the mail the primary mail server. (Large sites assign users to different hosts and route email appropriately.)

Mail does not need to be sent the MX, you can send directly from the servers generating the email. However, it would be better to use the MX for all incoming and outgoing messages. Consider configuring your other servers to use your MX as their smarthost. All servers sending to the internet should be listed in your SPF record.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.