Is it possible to configure exim to truncate outgoing emails after a certain number of lines or after certain key words?

2 Answers 2


Exim doesn't look at the contents of email messages, so no, it's not possible.

It's possible to limit the max size of messages (which means that larger messages are simply rejected). Truncating messages is effectively corrupting messages which is not what you want.

Perhaps your requirements could be catered for by using a filter before submitting messages to exim.

  • Thanks for the reply! I inherited this ticketing system (glpi), I am not very familiar with it since I didn't set it up and most of the documentation seems to be in french - which I don't speak. Is there a "black-box-approach" for implementing such a filter? Sep 24, 2015 at 17:27
  • Sorry, no; it depends on whether messages are delivered over tcp or by calling /usr/sbin/sendmail directly; basically if you have to ask then it'll be difficult to do :(
    – wurtel
    Sep 25, 2015 at 6:23

Sure it can be done. eg: use "head" in a transport filter.

in the transports section:

  transport_filter=/usr/bin/head -100


the count (100) includes the header lines, so either increase it a bit to compensate or count the lines in the headers and add that.

  transport_filter=/usr/bin/head -${eval 100 + ${strlen:$headers_raw}-${strlen:${sg{$headers_raw}{\n}{}}}}

emails containing MIME parts will be butchered mercilessly and probably not be readable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .