[exim-dev] Re: message_linelength_limit and transport_filter…

Top Pagina
Delete this message
Reply to this message
Auteur: Jasen Betts
Datum:  
Aan: exim-dev
Onderwerp: [exim-dev] Re: message_linelength_limit and transport_filter order
On 2023-12-07, Robert Blayzor via Exim-dev <exim-dev@???> wrote:
> It seems Exim has a default limit of 998 characters per RFC on SMTP 
> sending transport. If this is violated the message is rejected. I agree 
> with the limit, but trying to find a way to "fix" broken senders.
>
> An optimal way may be to have an option in Exim to "wrap" lines longer 
> than X. I know there is an argument on not doing this. I guess a 
> transport_filter could do this, but would run into the same issue 
> described below..
>
> A "workaround" for this was to pipe the message through a 
> transport_filter to just truncate lines longer than 998. Again, not 
> optimal, but need a fix to send these messages out without dropping them 
> completely.
>
> I was able to do this with the below..
>
> remote_smtp:
>    driver = smtp
>    transport_filter = /usr/bin/cut -c1-998
>
>
> But it appears Exim enforces message_linelength_limit BEFORE the 
> transport_filter, not after. Should the order of operation be changed to 
> do this check AFTER the transport_filter?
>
> The only workaround was to do something like:
>
> remote_smtp:
>    driver = smtp
>    message_linelength_limit = 1M
>    transport_filter = /usr/bin/cut -c1-998


yes, or 

 remote_smtp:
    driver = smtp
    message_linelength_limit = 1M
    transport_filter = ${if>{$max_received_linelength}{998}{/usr/bin/cut}} -c1-998

because if the lines are all short the filter is not needed.


also possibly  "fold -w998 -s" instead of "cut -c1-998"
  
  

> Not a big deal, it works. Just wondering if the linelength check should
> come after the filter and not before ...



the current check is based on the variable $max_received_linelength
adding a check that requires re-parsing the output would slow things
down.


--
Jasen.
🇺🇦 Слава Україні

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-dev.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-dev-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/