DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: email sender rewrite proxy  (Read 5,786 times)

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
email sender rewrite proxy
« on: August 17, 2021, 06:50 PM »
Hi folks! I am in need of collective wisdom. I need a band-aid to go between ancient LOB software and M365 email.

The company finally killed off the on premise Exchange and Notes servers. However, with all of the systems running on local servers and sending out emails to both company and external recipients, I had to put in place some proxy servers to gather the messages and relay through 365. This is done using hMailserver with a simple authenticated relay configuration, and sender addresses are all set up with mailbox delegation to the account the proxy server is sending as. Works fine, except...

We have one old system that sends email reports using a very specific sender address. The authors of this software hard coded the sender address using a domain that is currently owned by IBM. And because the relays can only accept sender addresses that are known in the organization, and we cannot define this domain in 365, the emails are rejected.

I have done my due diligence and have changed the offending sender address to an acceptable value, with the same number of characters, everywhere that I could find on this server. Still the bad address gets used. I have spent way too much time looking for where it is coming from, our DBA has dug through the database, still can't find it.

So all that is to explain why I am looking for an email proxy that will allow you to rewrite a sender address. Mail comes in, if it's from address xyz then it gets changed to be from abc, then gets sent on to the "normal" proxy. If the sender is not xyz, then it just gets sent on.

It needs to be something that can run on Windows server, ideally something as simple as hMailserver. I tried to write a rule for hMailserver to do this but was not successful. Volume of messages is low so does not need to be super efficient, just needs to be reliable.

Anyone have any ideas? I have not yet stumbled upon the magical query to make the google give me a good answer...
vi vi vi - editor of the beast

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: email sender rewrite proxy
« Reply #1 on: August 17, 2021, 08:13 PM »
Interesting.
Does it have to be a full blown smtp proxy server, or can you configure the email sender to use a commandline mail sending tool as its delivery method?

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: email sender rewrite proxy
« Reply #2 on: August 17, 2021, 10:17 PM »
Sadly there is no way to modify the system. And of course the people who set this up have been gone for years. (Isn't that always the case?)

I still have some vague ideas bouncing around in my head, maybe one of them will pan out. But between all the folks who visit DC, we have seen almost everything before.  :D
vi vi vi - editor of the beast

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,954
Re: email sender rewrite proxy
« Reply #3 on: August 18, 2021, 12:06 AM »
Maybe receive the mail, store it as a file, rewrite the header and use a mail client that you can use within batch/PowerShell scripting? 

A few command line mail clients that might be able to help with this:
- CMail
- SwithMail

Mail relay software might be good for such a purpose too. But I only know of:
- MiniRelay
Which is ancient, not maintained and the creator's website has been off-line for years.

Here are instructions to create an SMTP relay server on IIS, after which you could use Powershell to resend the message with a header that does comply with your current setup.
This set of instructions also seems helpful for your problem.
The easy path is usually downhill...

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: email sender rewrite proxy
« Reply #4 on: August 18, 2021, 01:22 AM »
Anyone have any ideas? I have not yet stumbled upon the magical query to make the google give me a good answer...

This thread sounds like the same problem:
https://www.hmailserver.com/forum/viewtopic.php?f=9&t=32387

With the relevant script at post:
https://www.hmailserver.com/forum/viewtopic.php?t=32387#p202248

Note the post saying to remove var a couple of posts later.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

x16wda

  • what am I doing in this handbasket?
  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
    • Participated in NANY Challenge Once
Re: email sender rewrite proxy
« Reply #5 on: August 18, 2021, 10:12 PM »
This thread sounds like the same problem:

Thanks - I didn't look deep enough in the support forum! This looks promising.
vi vi vi - editor of the beast

Original address: https://www.donationcoder.com/forum/index.php?topic=51672.0