/* Copyright (c) 1979 Regents of the University of California */
* Send message described by the passed pointer to the
* passed output buffer. Return -1 on error, but normally
* the number of lines written.
register struct message
*mp
;
putc(t
= getc(ibuf
), obuf
);
* Interface between the argument list and the mail1 routine
* which does all the dirty work.
for (s
= 0, ap
= people
; *ap
!= (char *) -1; ap
++)
for (ap
= people
; *ap
!= (char *) -1; ap
++) {
* Send mail to a bunch of user names. The interface is through
* the mail routine below.
* Mail a message on standard input to the people indicated
* in the passed header. (Internal interface).
* Collect user's mail from standard input.
if ((mtf
= collect(hp
)) == NULL
)
if (fsize(mtf
) == 0 && hp
->h_subj
== NOSTR
) {
printf("No message !?!\n");
if (intty
&& value("askcc") != NOSTR
)
* Now, take the user names from the combined
* to and cc lists and do all the alias
to
= usermap(cat(extract(hp
->h_to
), extract(hp
->h_cc
)));
printf("No recipients specified\n");
* Look through the recipient list for names with /'s
* in them which we write to as files directly.
exwrite(deadletter
, mtf
, 1);
if ((mtf
= infix(hp
, mtf
)) == NULL
) {
fprintf(stderr
, ". . . message lost, sorry.\n");
if (value("record") != NOSTR
)
savemail(value("record"), hp
, mtf
, namelist
);
* Wait, to absorb a potential zombie, then
* fork, set up the temporary mail file as standard
* input for "mail" and exec with the user list we generated
* far above. Return the process id to caller in case he
* wants to await the completion of mail.
* Prepend a header in front of the collected stuff
* and return the new file.
register FILE *nfo
, *nfi
;
if ((nfo
= fopen(tempMail
, "w")) == NULL
) {
if ((nfi
= fopen(tempMail
, "r")) == NULL
) {
* Dump the to, subj, cc header on the
fprintf(fo
, "To: %s\n", hp
->h_to
);
fprintf(fo
, "Subj: %s\n", hp
->h_subj
);
fprintf(fo
, "Cc: %s\n", hp
->h_cc
);
if (hp
->h_to
!= NOSTR
|| hp
->h_subj
!= NOSTR
|| hp
->h_cc
!= NOSTR
)
* Save the outgoing mail on the passed file.
savemail(name
, hp
, fi
, tolist
)
if ((fo
= fopen(name
, "a")) == NULL
) {
fprintf(fo
, "From %s %s", *(tolist
+1), ctime(&now
));
for (c
= getc(fi
); c
!= EOF
; c
= getc(fi
))