#!/bin/sh -
|
|
/usr/local/bin/gawk '
|
|
BEGIN {
|
|
getline seq < "/var/mlist/ML.seq"
|
|
close("/var/mlist/ML.seq")
|
|
++seq
|
|
print seq > "/var/mlist/ML.seq"
|
|
close("/var/mlist/ML.seq")
|
|
IGNORECASE=1
|
|
RS=""
|
|
}
|
|
NR==1 {
|
|
gsub(/\nReply-To:[^\n]*(\n[ \t][^\n]*)*/, "")
|
|
gsub(/\nReturn-Receipt-To:[^\n]*(\n[ \t][^\n]*)*/, "")
|
|
gsub(/\nErrors-To:[^\n]*(\n[ \t][^\n]*)*/, "")
|
|
gsub(/\nDisposition-Notification-To:[^\n]*(\n[ \t][^\n]*)*/, "")
|
|
if (match($0, /\nSubject:(\n?[ \t])*(\[ML [0-9]+\] *)*Re:/))
gsub(/\nSubject:(\n?[ \t])*((\[ML [0-9]+\] *)*(Re: *)*)*/, \
"\nSubject: [ML " seq "] Re: ")
|
|
else
gsub(/\nSubject:(\n?[ \t])*(\[ML [0-9]+\] *)*/, \
"\nSubject: [ML " seq "] ")
|
|
print
|
|
if (!match($0, /\nSubject:/))
print "Subject: [ML " seq "] "
|
|
print "Reply-To: ML@DOMAIN"
|
|
print ""
|
|
print "[ML " seq "]\n"
|
|
RS="\n"
|
|
next
|
|
}
|
|
{print}
|
|
' | /usr/lib/sendmail -oi -f owner-ML@DOMAIN ML-outgoing
|
|