On Mon, Mar 08, 2004 at 05:50:41PM -0600, Jeremy Kitchen wrote:
On Mon, 2004-03-08 at 17:38, Sam Varshavchik wrote:
In the never ending struggle to combat bad client implementations, I am
trying to write a script to detect a lack of a Subject: field in the
header.
I've tried, without success:
SUB=`reformail -x 'Subject:'`
if($SUB == 0) {
xfilter "reformail -a'Subject: (no subject)'"
}
Any suggestions?
if (! /^Subject:/)
does that work only in headers though? I could fool it into ignoring
that by sending an HTML mail with:
<!--
Subject: blah!
--!>
$ man maildropfilter # [1]
[SNIP]
PATTERN OPTIONS
Following /pattern/, there may be an optional colon, fol-
lowed by one. or more options. The following options may be
specified in any order:
h Match this pattern against the message header.
b Match this pattern against the message body.
[SNIP]
If neither 'h' or 'b' is specified, the pattern is matched
against the header only. Specifying the 'b' option causes
the pattern to be matched against the message body. Specify-
ing both causes the pattern to be matched against the entire
message.
[SNIP]
So the default is header only but you could use:
if (! /^Subject:/:h)
if you wanted to be paranoid.
[1] This is getting to be a habit.