EXIM including server IP in header, despite sending through external SMTP

chwba

Verified User
Joined
Dec 23, 2019
Messages
40
Hello,
I have followed the steps shown in this guide:
https://help.directadmin.com/item.php?id=153

Have set local_from_check = false in /etc/exim.conf (it was false by default). - Emails are being sent out just fine and the external SMTP is being used, through roundcube and through WPMailSMTP (a wordpress plugin to use external SMTP for sending emails)

When sending automated emails through the Wordpress-plugin WPMailSMTP the headers look just fine and don't include the servers IP address or hostname. If I send an email through roundcube though it does include the servers IP and hostname, how can I remove this information from the header, so it will be the same as when sending through WPMailSMTP.

Example header WPMailSMTP:
Code:
WPMailSMTP/Mailer/mailgun 1.8.1
from HE1EUR04HT038.eop-eur04.prod.protection.outlook.com (2603:10a6:6:29::15) by DB6P194MB0134.EURP194.PROD.OUTLOOK.COM with HTTPS via DB6P193CA0005.EURP193.PROD.OUTLOOK.COM; Sun, 8 Mar 2020 15:13:25 +0000
[email protected]
from HE1EUR04FT027.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::3c) by HE1EUR04HT038.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::320) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11; Sun, 8 Mar 2020 15:13:24 +0000
Pass (protection.outlook.com: domain of subdomain.mydomain.com designates 141.193.32.16 as permitted sender) receiver=protection.outlook.com; client-ip=141.193.32.16; helo=m32-16.eu.mailgun.net;
spf=pass (sender IP is 141.193.32.16) smtp.mailfrom=subdomain.mydomain.com; live.de; dkim=pass (signature was verified) header.d=subdomain.mydomain.com;live.de; dmarc=bestguesspass action=none header.from=mydomain.com;compauth=pass reason=109
a=rsa-sha256; v=1; c=relaxed/relaxed; d=subdomain.mydomain.com; q=dns/txt; s=k1; t=1583680404; h=Mime-Version: Content-Type: Subject: From: To: Reply-To: Message-Id: Sender: Date: Content-Transfer-Encoding; bh=1tJQbiQ9d3bs/+sQe1MFl+BFUsgM1eEMk83YzngtC0I=; b=SYbUf47Ycaoeb7VGB6bZzZBA0IKkiG2N14SM+GS92ofq0r9DUTv08YXdWUtV/XNTNWfrnFjX Yab555i3UMhiGvoGtnB5IyBW9QaMg6TShCnpVhmVu6AN6qb5seHFcluVkUUdDpkW9yvLWSJF SEwEJnYdkHBeVgBcnZM8BMsLWt29OgjZCc3SgR48NAg0340bkzuMZ0XMSiyq6lrMpQA9uTKh 7XBTl8OMwbPvsiwJpGasoysrjtknROoU13SrNq1iXxnXIrNSFa6kPD54OHPIXk2Pv81ktry1 20UJOmrsf4NCCdtjAc+FtAQYoB1jL3l+MetN2U2jKH3e+JoXiXHeYg==
text/html; charset="utf-8"
quoted-printable
1.0
141.193.32.16
WyJiMTdhNCIsICJzd2Fuc29uQGxpdmUuZGUiLCAiNTcwZDciXQ==
by luna.mailgun.net with HTTP; Sun, 08 Mar 2020 15:13:24 +0000
from m32-16.eu.mailgun.net (141.193.32.16) by HE1EUR04FT027.mail.protection.outlook.com (10.152.27.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11 via Frontend Transport; Sun, 8 Mar 2020 15:13:24 +0000
OriginalChecksum:695AED4A7C4375F55DA95B0C86316422E36EDC14BA0361AF99C1F0954AA517C7;UpperCasedChecksum:E2BEA5E9519C64C12ED05BEE7F079A47FB442F452D719FF160855FCA39E93020;SizeAsReceived:1283;Count:16
16
08 Mar 2020 15:13:24.4583 (UTC)
OriginalSubmit
1:00:00:00.0000000
OriginalSubmit
24b1c722-4d58-48a4-f0b9-08d7c3733f29
0
84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa:0
Incoming
EFV:NLI;
HE1EUR04FT027.eop-eur04.prod.protection.outlook.com
Anonymous
Email
24b1c722-4d58-48a4-f0b9-08d7c3733f29
HE1EUR04HT038:
true
141.193.32.16
[email protected]
PASS
2
BCL:0;
outlook.com
08 Mar 2020 15:13:24.3532 (UTC)
24b1c722-4d58-48a4-f0b9-08d7c3733f29
84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
Internet
00000000-0000-0000-0000-000000000000
HE1EUR04HT038
00:00:00.8199273
15.20.2793.013
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ucf:0;jmr:0;ex:0;auth:1;dest:I;ENG:(5062000261)(5061607266)(5061608174)(4900115)(4920090)(6515079)(4950130)(4990090);
5vMbyqxGkdfTwBQAbsKvuAbH4dt5VR1v0P2CKpjzcUL2ZVAp4RWQ6e91i4Zmo/spJH8kmdjaVFEG08h5wx9pQTTEofVzxqeZXPiXu4AvbtHgKubY5BQBDExkO+JLDdhvdHXV+myenrgW5gerG9rMPaKmm9zPGGzZPec/N4dU/YFx29UpSwbFLKq5vmLV9IyMEApynclcj84qGRruiHFthw==
Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0z
qFr8/qdMJoTZSqvP01dRDP/cBb2J1YQwjeaW47xOmQToLECeZauXEpYF7vIObljx91hTt6MTATy2K7oDME+8rCqicXKULrpFgobM3WVsdWor0NfJFTR9n09Nk7Tp9jVUkaZ4Kfi/5BMAxjdViV5WOvqYPXMwkpk/Z1ujXMkwrKSBX6NtI7Lqrh78U3aCLQdifIruEvFN/Uo6X68/3OYk/BPw4h7oEY+wryCLjb3bfcFWHO1lbZwjYn/1YVW3K9loRFA7ok/97rPT+bpETmQ8/N/MgiFH4rdUrj66SxmbRZs7IGLXmtCMWwVwHLQOA/3Uc7UfUUTO3a/1EF1EVSqc3d1Jlsa0R5eW23GcCJNmkjMrYdo/v59Y8f1Pix1yGqmyp6q0mpw1GJ/dy2NO30y7+yhRc3ah0ue4zDNAhi3+/A8MBXivoRl3HSmuaf2hPXcsitfREEaMXiEbs2VJI5t8AdoWCuJDCzPDomp/ixVXlXVRR9gvKbV8Nw6RQ8JPO3OZHG4WH43R8ipV4rpq4Tvn2qX2FSeZfNSlYRXr5Fl/kZFUr3bVGjKtrge3PH7ZFNIzuFnKWcBxQR3kRVEwr1Xdo8TPoWMX17OXkjMOV+wTC26cdnjqZANst3cDOzs5FI4TGJsAwGxOkvKqvyYIA6YPJ75p74t+GZKG4o4d+g3UNz6CYrxzxANZh9tpaibTdEG0hlydYJI4WecWdet12Qqfddr4decmz7Vky4jT1EJ9bUTNtFrk/I9HuRa54Y5iQj+SSuWAe29VR1mEHBLw8H/bnLS80eNJ6Eq4p14omaOicoy7QnIRJLGfxC9n8B7+wxTsO4TlG0bd7J6qGlk5Oz+JEA/Vw32dcJm7QQWxCtxtP+/L7oTQHFSAH8yLscEioGOXPnqoNifMzj+Oen1bWin965vCoHGth6FAVLFDiEEQmOFhv2MYgOrussYZ4RV1RcOuvHegXaAON5dF4c5tRhUpA5MYL0p7jckrhKarSTZ6gKs2cAHRd4FFKaDfIJ4kER5xKBJ49tlmGR795YUkR80BEnuWcvx0ti5wx77S5JXbJA0=
Completed Order
3/8/2020 2:07:08 PM

Example header roundcube:
Code:
Roundcube Webmail/1.4.3
from AM6EUR05HT043.eop-eur05.prod.protection.outlook.com (2603:10a6:4:3e::48) by DB6P194MB0134.EURP194.PROD.OUTLOOK.COM with HTTPS via DB6PR0301CA0038.EURPRD03.PROD.OUTLOOK.COM; Sun, 8 Mar 2020 16:03:05 +0000
[email protected]
from AM6EUR05FT016.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::39) by AM6EUR05HT043.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::391) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11; Sun, 8 Mar 2020 16:03:05 +0000
Pass (protection.outlook.com: domain of subdomain.mydomain.com designates 141.193.32.16 as permitted sender) receiver=protection.outlook.com; client-ip=141.193.32.16; helo=m32-16.eu.mailgun.net;
spf=pass (sender IP is 141.193.32.16) smtp.mailfrom=subdomain.mydomain.com; live.de; dkim=pass (signature was verified) header.d=subdomain.mydomain.com;live.de; dmarc=bestguesspass action=none header.from=mydomain.com;compauth=pass reason=109
a=rsa-sha256; v=1; c=relaxed/relaxed; d=subdomain.mydomain.com; q=dns/txt; s=k1; t=1583683385; h=Content-Type: Message-ID: Subject: To: From: Date: MIME-Version: Sender; bh=DqeHCFXh8vRz+KmCsgohicEZuNn5n/7ywnbOd5kRONE=; b=tIZT63AkOFzpF6Q0Cfk7aB03H6RVsUeIL/RKu2otJFEOMJxa07Age1LgP4RAam5ci6ShU8b7 BSx3/4Jc0YRV7HEjkeWiFhJiZDCoDz9rz4ywG91apcxCeZqrAuFc8eJuY1sMP+f/jXch2Q1O jCJ9Vz1zLVRFtm2lGzyKcz71q0txLILYkOzaIVmvsEwb3cdMYw8I99u1YBFQ4QanlxZ/O6le R2x0GI46Iw+nOtTYax3N2MW2c8pT3SOpz/HhBhyujnmlXw2fniTKd4oW/LPR92el8mAB4gu/ 5P09l52sA14Oi90CaOYGW+Li59rysUcC8CV1OYDvW+ZPKZzkFEeZmg==
multipart/alternative; boundary="=_1c604834f773c6213f0d223572dbe6a3"
1.0
141.193.32.16
WyJiMTdhNCIsICJzd2Fuc29uQGxpdmUuZGUiLCAiNTcwZDciXQ==
from myservershostname.mydomain.com (Unknown [MY-SERVERS-IP-HERE!]) by mxa.mailgun.org with ESMTP id 5e6516c5.7f67894e9b30-smtp-out-n02; Sun, 08 Mar 2020 16:01:09 -0000 (UTC)
from [127.0.0.1] (helo=myservershostname.mydomain.com) by myservershostname.mydomain.com with esmtpa (Exim 4.93.0.4) (envelope-from <[email protected]>) id 1jAyMX-0004G5-9q for [email protected]; Sun, 08 Mar 2020 17:01:09 +0100
[email protected]
from m32-16.eu.mailgun.net (141.193.32.16) by AM6EUR05FT016.mail.protection.outlook.com (10.233.240.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.11 via Frontend Transport; Sun, 8 Mar 2020 16:03:03 +0000
OriginalChecksum:326B126345B3E2FF4E28247E65A483324991E89C4AB44209027E296C784F171C;UpperCasedChecksum:DF069EFACFB33ABB839C2DB120E47E3256161CDFCD5E9BDFBCD2A00549BBF703;SizeAsReceived:1529;Count:16
16
08 Mar 2020 16:03:05.2851 (UTC)
OriginalSubmit
1:00:00:00.0000000
OriginalSubmit
76fe9bb9-b03d-4133-0672-08d7c37a2fe0
0
84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa:0
Incoming
EFV:NLI;
AM6EUR05FT016.eop-eur05.prod.protection.outlook.com
Anonymous
Email
76fe9bb9-b03d-4133-0672-08d7c37a2fe0
AM6EUR05HT043:
true
141.193.32.16
[email protected]
PASS
2
BCL:0;
outlook.com
08 Mar 2020 16:03:03.1274 (UTC)
76fe9bb9-b03d-4133-0672-08d7c37a2fe0
84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
Internet
00000000-0000-0000-0000-000000000000
AM6EUR05HT043
00:00:02.6036421
15.20.2793.013
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ucf:0;jmr:0;ex:0;auth:1;dest:I;ENG:(5062000261)(5061607266)(5061608174)(4900115)(4920090)(6515079)(4950130)(4990090);
5vMbyqxGkdcWeD1ZDA5uiBiNOfis84QOY2nynmCpuY6hEsrbTcF0CM6iWAj1//nStlw778HhZzLxFqEYHGcMda66qJkvzEciVK2PGbVsxRiOt8enl13oabOg9XsWB3xtOUS6Fwf/2gg79inoyAegELp1MqdsyEivxPtoNNw4qpr3puYWXR45dlW/M73ne8HkESH59/FcNJNB7ECNVHO64g==
Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0z
qfB1bGGmvAypGTpVja1cKL8XBIVIZQ+BBl5LuCFfs8fKkgD4bwUEiAFw4mj5pVKiBt2uKDfVtf3cT8v15Ot9LFSwwLeZ0qMp9CToxTMNQUn8DJl3JqLOeozY2w1+uTHTf1IGh/MoALvcJx7rWKiUv7ccVZJUHFzZvc2LIHe/65nZgf2j1uNcK2nJAqtTXvRx4+MQoUp3R9HwQrtlSNXLQZeurqUzdBabewP31DNSWR5odF3xSxFMicQlImeAK09SjzzStU22J/Zej+bqi4mtihcUMvOTX+nKe6yRGWOYVhyRvdAXag4n6SL1gp8YoIB8qZXHJUPkPZzoAHIcpv1TmY3f3MJYI9zkq2SoSc/wI6O0oSz7J/hh0pQXfM5KfwbnrWdZcm8No9peHNsKBkKTseHSGDJEA41H8CEImd7TybEohQUX/pfCj18aX1pYjLbRp1WcbmeRwx8uedJ9rmGPJNeZl9iZfjayvOG1Duc1ZWzx+3RK2aHKSYDjQnk+hJJasknQFzhIbemZAWV1GqUHw5oFfTQMGYynauc2hPmBBtbODAbyKp7dy4oiLN+zkOnvSQUckWZk+bCwEWHl79GDa+GhHDyleuWdiF9PdnmOqfYk0OdhJzQkXAE7VH8dC0Od/2d0smw+jsx6244+seZJjqP8vPThQqAiRjji+rk1vcR9YiUwtrd7WBZvf+ZhS/+m4JvvKvGnr9h6jlz5TON/RnEWcDBiEOpAug4pSu/1Jqq6me5Cfjt4PlO6SbPS9Vy8vANHtogrJhZUgGrnM0ko8nYXBHKh6RTpulUXTheCVfVuRTraMank6OPo2O0NOP5q4AlyTfhlKIyBLbd22rmTlMqmZYEJmbfGh25oBYdef6B3Vb73jvAIJ6qt3p/1g6tUyVYfNGvVDDPeGWTjxqJcBbOWXM1PwOwEWe2o9SGzb1VaaHacjkYCGHFq48PWAL6CSLpBFoHkcO9bQ6M+u6f4mg==
3/8/2020 4:01:42 PM
 
The problem here is that it isn't your server writing your server's IP in the headers. It's the job of the next server to say "This server connected to me, and they had this IP." So while I could give you a configuration that would exclude the system connecting to your server (preventing your server from saying "This computer connected to me and it has this IP"), there's no config you can make on your server that excludes the next server from doing that to you. That next server in your case appears to be mailgun, and you could request it of them but I don't know that they'll do it. Otherwise, to take matters solely into your own hands, you'll need to build another relay that doesn't write that Received header about your server and then passes it on to mailgun, so that only your relay IP is exposed.

To be clear, it's this line that you gave:

from myservershostname.mydomain.com (Unknown [MY-SERVERS-IP-HERE!]) by mxa.mailgun.org with ESMTP id 5e6516c5.7f67894e9b30-smtp-out-n02; Sun, 08 Mar 2020 16:01:09 -0000 (UTC)

Note that this line is written by mxa.mailgun.org, and that's the part that you can't control. I find it odd that you're not seeing your server's IP when Wordpress sends the email, but what you pasted also isn't standard email headers and I'm wondering if it was simply excluded from whatever method you're using to view them.
 
Last edited:
@Richard G if i get this link right this would mean turning of the local mail server and set it to receive mails through this one, im just about sending emails though not receiving
 
The reason for the IP being in the header when using SMTP was caused by mailgun. The Wordpress plugin is using mailguns API to send email, for emails sent via API mailgun does not include the IP.
 
Back
Top