• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved Mail handlers: Accessing "Received" header

Lutuh

New Pleskian
Hi all,

this question is about the Mail Handlers feature in Plesk 12.5 for Linux (https://docs.plesk.com/en-US/12.5/extensions-guide/mail-handlers.71844/). I'm using Postfix.

For an incoming email, I would like to get the sender IP address that can be found in the "Received" header, e.g.

Received: from somedomain.com (ec2-53-129-25-139.compute-1.amazonaws.com [53.129.25.139])
by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id fO-7wrjmSeqrZAzFoOXgbg
for <user@mydomain.net>; Mon, 24 Oct 2016 07:05:22.959 +0000 (UTC)

I've added a before-queue mail handler to Plesk and when looking at the email message that this handler receives via stdin, this header is missing. The message looks like this:

Subject: Test
Message-Id: <20161030180712.997E4100150@somedomain.com>
Mon, 24 Oct 2016 07:05:22.959 +0000 (UTC)
From: info@somedomain.com

<Message here>

My guess is that since this mail handler is pre-queue, there won't be any "Received" header until the message is being queued. So I went and registered a before-local handler, but this one does not even get called, so no "Received" header there, either.

Thank you for any ideas or suggestions you might have on this topic. I know it has to work somehow because the onboard "SPF" mail handler has to be able to access the sender IP as well in order to function at all.

Cheers,
Lucas
 
Got it figured out. I was initially using the same mailbox for sending that test email, so using local delivery. It looks like the "Received" header won't show up then. When using a different, non-local mailbox to send the test email, the "Received" header shows up just fine. May this be of use for someone.
 
If using the before-queue type mail handler, the sender IP and HELO hostname can be found in the environment variables SMTPHELOHOST and TCPREMOTEIP.
 
Hello @Lutuh,
I am trying to create a mail handler that sends certain emails to an external server, but I can't get the bcc header, did you know anything that could help me? How can I access this environment variables that you talk about?
 
Back
Top