Justin Lloyd <jlloyd(_at_)hisd(_dot_)harris(_dot_)com> writes:
I've written a Perl 5 script that archives daily and monthly my procmail log.
It uses sendmail to mail me output from mailstat. However, in my .mailrc
file, I have the line
set record=$HOME/Mail/outgoing
so the mailstat mails always get copied there. Is there a way to have my
script temporarily turn this auto-saving off, other than hacking .mailrc or
the outgoing mailbox? Would having the script change permissions on the
outgoing mailbox be a reasonable fix?
If the 'record' is having an effect, then you're not calling sendmail,
but rather "mail". Call sendmail directly. Your code should probably
look something like:
$ENV{'PATH'} .= ":/usr/lib";
open(MAIL, "|sendmail -oi -bm my-address-here")
|| die "Unable to fork: $!";
print MAIL "To: my-address-here\nSubject: mailstats\n\n";
print MAIL body-of-the-message;
close(MAIL) || do {
if (($? & 0377) == 0) {
die "sendmail returned ", $? >> 8;
} else {
die "sendmail died with signal ", $? & 0177,
(($? & 0200) && ", coredumped");
}
};
Followups to this message should be off-list.
Philip Guenther