On Fri, Jan 13, 2023 at 05:36:16AM +0000, Sean Hennessey wrote:

> I was using the sender_dependent_default_transport_maps to pick off
> what I thought was going to be the interesting from domain. The good
> news is that this mail is coming from customer applications. It's not
> coming from regular user mail clients. So I can guarantee there is
> going to be a single from header. The recipients are also never local.
> This machine is a pure relay.
> 
> Looks like it's time to learn me some milter. Can you recommend any
> good places to start on walking me through building one. I've got a
> programming background, so coding doesn't scare me.

I found the Python "Milter" module quite easy to use.  

FWIW, you don't strictly need milters if all you is something equivalent
to a regex match on the "From:" header, header_checks can do that, BUT:

    * With a milter you get an address parser, not just regular
      expressions, so that:

        From: "<j...@whitehouse.gov>" <v...@kremlin.ru>

      parses correctly.

    * With a milter you can add logic to deal with missing headers,
      multiple addresses, ... and perhaps also inspect the client
      IP address or SASL id, ...

So do use a milter, but do it right.  A crude regex check doesn't count.

-- 
    Viktor.

Reply via email to