Score:0

Exim: send emails from different ips and hostnames on the same vps

cn flag

I have 2 ips on my server, I’m trying to set up 2 emails, one email sends from one ip, the other sends from the second ip. The first email is fine but I’m getting an error in mail-tester.com for the second email (ips are obviously dummy examples):

Your IP address 1.1.1.2 is associated with the domain port25.domain.com. Nevertheless your message appears to be sent from port24.domain.com. You may want to change your pointer (PTR type) DNS record and the host name of your server to the same value. Here are the tested values for this check: IP: 1.1.1.2 HELO: port24.domain.com rDNS: port25.domain.com

My setup on my vps - 2 ip’s each has their own hostname rdns port24.domain.com → 1.1.1.1 (ip1) port25.domain.com → 1.1.1.2 (ip2)

I’ve set up 2 domains in vesta cp, domain1.com uses ip1, domain2.com uses ip2. DNS is correct.

I’ve created emails in roundcube. I’ve added the following to my exim conf:

interface = ${lookup{$sender_address_domain}lsearch{/etc/exim/mailips}{$value}{}} helo_data = ${if exists {/etc/exim/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/exim/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}

(here is a link to a google doc with my exim config)

I’ve added the following to my mailips and mailhelo file:

mailips: domain1.com:1.1.1.1 domain2.com:1.1.1.2

mailhelo: domain1.com: port24.domain.com domain2.com: port25.domain.com *: port24.domain.com

The previous error in mail-tester.com shows emails from domain2.com on 1.1.1.2 are coming from port24 when they should be coming from port25.

# telnet 1.1.1.2 587 
Trying 1.1.1.2... Connected to 1.1.1.2. Escape character is '^]'. 220 port24.domain.com ESMTP Exim 4.96 Sat, 08 Jul 2023 10:57:23 -1000

How do I solve this?

anx avatar
fr flag
anx
Why two addresses of the same protocol in the first place? It is perfectly reasonable to have a single mail server, operated under the responsibility of a single business entity, to be handling mail for multiple domains. You may be trying to setup something complicated when the simpler solution is more appropriate.
user2765920 avatar
cn flag
I've got two teams of cold emailers and the idea was to keep the emails on their own ips. But I think you're right, keeping the email domains on the same ip is going to make things less complicated. I can't find any documentation about the solution otherwise.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.