sendmail.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mail.h"
/*
Send mail - High level sending routine
*/
char **argv;
{
char **args;
int aret;
int i, n;
int oldn = 1;
int ttyf = 0;
int pushrest = 0;
int hdrtyp = 0;
int binflg = 0;
long count = 0L;
static char pn[] = "sendmail";
for (i = 1; i < argc; ++i) {
if (argv[i][0] == '-') {
}
if (i > 1) {
}
done(0);
}
/*
Ensure no NULL names in list
*/
done(0);
}
}
mktmp();
/*
Format time
*/
trimnl (datestring);
/* asctime: Fri Sep 30 00:00:00 1986\n */
/* 0123456789012345678901234 */
/* RFCtime: Fri, 28 Jul 89 10:30 EDT */
/*
Write out the from line header for the letter
*/
} else {
}
done(0);
}
/*
Copy to list in mail entry?
*/
while (--aret > 0) {
done(0);
}
}
}
/*
Read mail message, allowing for lines of infinite
length. This is tricky, have to watch for newlines.
*/
pushrest = 0;
/*
* scan header & save relevant info.
*/
fromS[0] = 0; /* set up for >From scan */
perror("stdin");
exit(1);
}
}
if (pushrest) {
done(0);
}
continue;
}
break;
}
flgf = 0;
switch (hdrtyp) {
case H_RVERS:
/* Are we dealing with a delivery report? */
/* dflag = 9 ==> do not return on failure */
dflag = 9;
break;
case H_FROM:
done(0);
}
/* note dropthru */
case H_FROM1:
break;
}
if (Rpath[0] != '\0') {
}
n = 0; /* don't copy remote from's into mesg. */
break;
case H_MIMEVERS:
case H_CLEN:
case H_CTYPE:
/* suppress it: only generated if needed */
n = 0; /* suppress */
break;
case H_TCOPY:
/* Write out placeholder for later */
done(0);
}
n = 0; /* suppress */
break;
case H_MTYPE:
if (flgm) {
/* suppress if message-type argument */
n = 0;
}
break;
case H_CONT:
if (oldn == 0) {
/* suppress continuation line also */
n = 0;
}
break;
}
oldn = n; /* remember if this line was suppressed */
done(0);
}
}
if (Rpath[0] != '\0') {
}
/* push out message type if so requested */
if (flgm) { /* message-type */
done(0);
}
}
if (flgf) {
/* no input */
return;
} else {
/*
* no content: put mime-version, content-type
* and -length only if explicitly present.
* Write out 'place-holders' only. (see below....)
*/
done(0);
}
}
done(0);
}
}
done(0);
}
}
goto wrapsend;
}
}
/*
* no content: put mime-version, content-type
* and -length only if explicitly present.
* Write out 'place-holders' only. (see below....)
*/
done(0);
}
}
done(0);
}
}
done(0);
}
}
goto wrapsend;
}
}
if (debug > 0) {
buf[n] = '\0';
}
/*
* Write out H_MIMEVERS, H_CTYPE & H_CLEN lines. These are used only as
* placeholders in the tmp file. When the 'real' message is sent,
* the proper values will be put out by copylet().
*/
done(0);
}
}
done(0);
}
}
done(0);
}
}
/* and a blank line */
done(0);
}
pushrest = 0;
count = 0L;
/*
* Are we returning mail from a delivery failure of an old-style
* (SVR3.1 or SVR3.0) rmail? If so, we won't return THIS on failure
* [This line should occur as the FIRST non-blank non-header line]
*/
}
/* scan body of message */
while (n > 0) {
break;
if (!binflg) {
}
done(0);
}
count += n;
n = ttyf
}
/*
* In order to use some of the subroutines that are used to
* read mail, the let array must be set up
*/
nlet = 1;
/*
* Modify value of H_MIMEVERS if necessary.
*/
}
}
/*
* Modify value of H_CTYPE if necessary.
*/
}
}
/*
* Set 'place-holder' value of content length to true value
*/
"%ld", count);
}
tmperr();
done(0);
}
/* Do not send mail on SIGINT */
if (dflag == 2) {
done(0);
}
done(0);
}