On Wed, Oct 24, 2001 at 09:01:17AM +0200, R . Leponce wrote: > Is there a way to limit the size of CC and To field when receiving an > email also sent to many users ?
Not built in to mutt, but it can be done with an external script and the display_filter variable. I use the following in my muttrc: set display_filter=mail-to-filter where mail-to-filter is a perl script (attached) which I wrote originally in awk and converted to perl with a2p. "To:" and "Cc:" lists are only truncated if they are longer than three lines and the deleted lines are replaced with a message saying how many lines were deleted. Since the filter is applied only as the message is displayed, the original message remains intact so that, for example, group replies work correctly. Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Spokane, Washington, USA http://www.spocom.com/users/gjohnson/mutt/ |
#!/usr/local/bin/perl # mail-to-filter - strips long distribution lists from mail # # AUTHOR # Gary A. Johnson <[EMAIL PROTECTED]> # Agilent Technologies # Spokane, Washington # May 22, 2000 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. # (remove #! line above if indigestible) eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift; # process any FOO=bar switches $[ = 1; # set array base to 1 $, = ' '; # set output field separator $\ = "\n"; # set output record separator $in_to_list = 0; $in_cc_list = 0; $spaces = sprintf('%80s', ''); line: while (<>) { chop; # strip record separator s/\s+$//; # Remove excess spaces at the ends of lines # that can cause lines to wrap unnecessarily. @Fld = split(' ', $_, 9999); if ($in_to_list == 1) { if (/^T[Oo]:.*@/) { $lines += 1; $last_line = $_; next line; } if (/^[^ \t]/ || /^$/) { if ($lines == 1) { print $last_line; } elsif ($lines > 1) { print $indentation . '[' . $lines . ' lines deleted]'; } $in_to_list = 0; } else { $lines += 1; $last_line = $_; next line; } } if ($in_cc_list == 1) { if (/^C[Cc]:.*@/) { $lines += 1; $last_line = $_; next line; } if (/^[^ \t]/ || /^$/) { if ($lines == 1) { print $last_line; } elsif ($lines > 1) { print $indentation . '[' . $lines . ' lines deleted]'; } $in_cc_list = 0; } else { $lines += 1; $last_line = $_; next line; } } if (/^T[Oo]:.*@/) { $indentation = substr($spaces, 1, index($_, $Fld[2]) - 1); $in_to_list = 1; $lines = 0; } if (/^C[Cc]:.*@/) { $indentation = substr($spaces, 1, index($_, $Fld[2]) - 1); $in_cc_list = 1; $lines = 0; } print $_; } exit 0;