Author Topic: Exim: trying to send emails from different ips and hostnames  (Read 5839 times)

Offline ClintonLee83

  • Newbie
  • *
  • Posts: 5
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):

Quote
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:


Quote
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}}

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


Quote
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 is also showing port24 rather than port25:


Code: [Select]
# 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

Any ideas how I can solve this?

Offline Dmitry42

  • Full Member
  • ***
  • Posts: 232
Re: Exim: trying to send emails from different ips and hostnames
« Reply #1 on: July 09, 2023, 11:49:20 AM »
PTR record for domain - its reverse record for DNS.

For example you have DNS
port24.domain.com → 1.1.1.1 (ip1)
port25.domain.com → 1.1.1.2 (ip2)

so you must ask your internet provider (who give you 2 ip) setup PTR records in they DNS server like this
1.1.1.1 → port24.domain.com
1.1.1.2 → port25.domain.com