From: Loki Harfagr on
Tue, 24 Jun 2008 17:54:40 -0400, David F. Skoll did cat :

> loki harfagr wrote:
>
>> I understand your concern, I can even 'feel' why you're questioning
>> the exit code, though I have the idea it is not exactly something that
>> *should* be questioned to sendmail.
>
> I disagree.

Cheers David,
I'm sorry that I'm slightly stretching the bits :-)

> If Sendmail fails to send mail, it should exit with
> non-zero exit status.

Well, the problem is then semantic ;-)
In this case I'd say that Sendmail didn't fail to send mail
but was the victim of a general failure, hence it just gacefully
abandon fight trying to be the less possible noisy but still
giving an alarm message.
I really believe that the underlying problem should have been
controled and stopped before (hence the net layers parallel).

Still, there's a possible way to control the 'failure' within
a script, as the OP wanted to do:

> I suspect that it can be convinced to do so by
> setting the ErrorMode option to "q", but I haven't tested that.
> Something like this might work:
>
> sendmail -o ErrorMode=q recipient

I tested it but it seems to make no difference at all.

Here's a possible mean to be used in a script :
using the tweaked submit.cf (MinFreeBlocks=99999999999999)
a capture variable *will have* a content:
-------------
# toto=$(echo test | sendmail root) && echo $? && printf "outvar=\n${toto}"
0
outvar=
Insufficient disk space; try again later
Insufficient disk space; try again later
returntosender: cannot select queue for root
Insufficient disk space; try again later
returntosender: cannot select queue for postmaster
-------------

clickety click, repair the .cf
-------------
# vi /etc/mail/submit.cf
-------------

"et voilĂ ", there's a scriptable difference: the result var is now void:
-------------
bash-3.2# toto=$(echo test | sendmail root) && echo $? && printf "outvar=\n${toto}"
0
outvar=
-------------

(back about -o ErrorMode=q)
> except that it drops privileges (which is highly annoying...)

Please, what doc reference this? From the O'R.SM-3d and 4th I had
the impression it was described as 'safe'. Maybe I read it wrong, I'll
check some time but if you freshly read another doc that says so I'd like to
check it as well :-)