Add the -E flag to not send messages that have an empty body. This is
useful for piping cron script error output by mail. PR: bin/9494 Obtained from: NetBSD MFC after: 2 weeks
This commit is contained in:
parent
47d3082050
commit
e65f95daf3
@ -40,7 +40,7 @@
|
||||
.Nd send and receive mail
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl iInv
|
||||
.Op Fl EiInv
|
||||
.Op Fl s Ar subject
|
||||
.Op Fl c Ar cc-addr
|
||||
.Op Fl b Ar bcc-addr
|
||||
@ -50,11 +50,11 @@
|
||||
.Ar sendmail-option ...
|
||||
.Oc
|
||||
.Nm
|
||||
.Op Fl iInNv
|
||||
.Op Fl EiInNv
|
||||
.Fl f
|
||||
.Op Ar name
|
||||
.Nm
|
||||
.Op Fl iInNv
|
||||
.Op Fl EiInNv
|
||||
.Op Fl u Ar user
|
||||
.Sh INTRODUCTION
|
||||
.Nm Mail
|
||||
@ -68,6 +68,9 @@ with lines replaced by messages.
|
||||
Verbose mode.
|
||||
The details of
|
||||
delivery are displayed on the user's terminal.
|
||||
.It Fl E
|
||||
Don't send messages with an empty body. This is useful
|
||||
for piping errors from cron scripts.
|
||||
.It Fl i
|
||||
Ignore tty interrupt signals.
|
||||
This is
|
||||
|
@ -93,7 +93,7 @@ main(argc, argv)
|
||||
bcc = NULL;
|
||||
smopts = NULL;
|
||||
subject = NULL;
|
||||
while ((i = getopt(argc, argv, "INT:b:c:dfins:u:v")) != -1) {
|
||||
while ((i = getopt(argc, argv, "EINT:b:c:dfins:u:v")) != -1) {
|
||||
switch (i) {
|
||||
case 'T':
|
||||
/*
|
||||
@ -181,13 +181,19 @@ main(argc, argv)
|
||||
*/
|
||||
bcc = cat(bcc, nalloc(optarg, GBCC));
|
||||
break;
|
||||
case 'E':
|
||||
/*
|
||||
* Don't send empty files.
|
||||
*/
|
||||
assign("dontsendempty", "");
|
||||
break;
|
||||
case '?':
|
||||
fprintf(stderr, "\
|
||||
Usage: %s [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
|
||||
Usage: %s [-EiInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...\n\
|
||||
%*s [- sendmail-options ...]\n\
|
||||
%s [-iInNv] -f [name]\n\
|
||||
%s [-iInNv] [-u user]\n",__progname, strlen(__progname), "", __progname,
|
||||
__progname);
|
||||
%s [-EiInNv] -f [name]\n\
|
||||
%s [-EiInNv] [-u user]\n",__progname, strlen(__progname), "",
|
||||
__progname, __progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -323,6 +323,8 @@ mail1(hp, printheaders)
|
||||
}
|
||||
}
|
||||
if (fsize(mtf) == 0) {
|
||||
if (value("dontsendempty") != NULL)
|
||||
goto out;
|
||||
if (hp->h_subject == NULL)
|
||||
printf("No message, no subject; hope that's ok\n");
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user