- /*
- ** We will get the mail from a file
- ** (typically the standard maildrop)
- */
- if (from)
- newmail = from;
- else if ((newmail = getenv("MAILDROP")) && *newmail)
- newmail = toabsdir(newmail);
- else if ((newmail = context_find("maildrop")) && *newmail)
- newmail = toabsdir(newmail);
- else {
- newmail = concat(MAILDIR, "/", MAILFIL, NULL);
- }
- if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
- adios(NULL, "no mail to incorporate");
+ if (from && strcmp(from, "-")==0) {
+ /* We'll read mail from stdin. */
+ newmail = NULL;
+ } else {
+ /* We'll read mail from a file. */
+ if (from)
+ newmail = from;
+ else if ((newmail = getenv("MAILDROP")) && *newmail)
+ newmail = toabsdir(newmail);
+ else if ((newmail = context_find("maildrop")) && *newmail)
+ newmail = toabsdir(newmail);
+ else {
+ newmail = concat(mailspool, "/", getusername(), NULL);
+ }
+ if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
+ adios(EX_DATAERR, NULL, "no mail to incorporate");