[Mailmunge] Add Header based on condition in filter_recipient{}

Dianne Skoll dianne at skollsoft.com
Wed Jul 31 17:34:40 EDT 2024


On Wed, 31 Jul 2024 14:32:29 -0400
list--- via Mailmunge <mailmunge at lists.mailmunge.org> wrote:

> Maybe. There are a dozen checks done in recipient and any one of them
> could be the reason i want to add the header. They could also reject
> the the mail, and moving the checks to filter_message() delays
> freeing up the connection.

Do the tests in both places by refactoring them out into a
self-contained function.  Unless the tests are very expensive, this is
a perfectly reasonable solution.

> I would have to go back through the code to ensure all of the checks
> could be done in filter_message(), that they aren't relying on
> something only available in filter_recipient().

Everything available in filter_recipient is also available in filter_message.

> And i cringe at the idea of redoing these checks in a looping of
> @recipients.

Why?  Unless your mail server is CPU-bound, it should not be a big deal.

Because of how Milter works, and because of the fact that Postfix doesn't
allocate a queue-ID until the first valid RCPT To: command, there's really
no good way to correlate a filter_recipient() with a corresponding
filter_message().  If you use Sendmail, then you can correlate by queue-ID
and store data in files in the current working directory that you can retrieve
later on.  But IMO it's not worth it.

Regards,

Dianne.


More information about the Mailmunge mailing list