[comp.mail.sendmail] full description of .forward

victor@arnor.uucp (10/30/90)

Can someone supply me with (or point me to) a FULL description of the
contents of .forward?  In particular what can be inside of a "| ".  Must
it be just one command, or can it be a series of commands like
"comm1; comm2".  Is this just passed to /bin/sh.  I've looked in the
sendmail/doc directories, but nothing is said about this.

--
			Victor S. Miller (victor@ibm.com)
			itinerant Number Theorist
			IBM, TJ Watson Research Center

rickert@mp.cs.niu.edu (Neil Rickert) (10/30/90)

In article <VICTOR.90Oct29151207@irt.watson.ibm.com> victor@arnor.uucp writes:
>Can someone supply me with (or point me to) a FULL description of the
>contents of .forward?  In particular what can be inside of a "| ".  Must
>it be just one command, or can it be a series of commands like
>"comm1; comm2".  Is this just passed to /bin/sh.  I've looked in the
>sendmail/doc directories, but nothing is said about this.
>

 .forward consists of a comma separated list of addresses.  It is permissible
for one or more of those addresses to be programs, as in:
"|program parameters".

 When a program is found in .forward (or in the system aliases file) it is fed
to the 'prog' mailer.  Look in 'sendmail.cf' for a definition.  In my setup,
the mailer is defined as:

Mprog,	P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u

 This means that everything following the '|' is just fed as an argument to
/bin/sh -c

 In other words, any string valid for the -c option of /bin/sh should be
ok.  As long as the command is quoted with ", the actual details of what is
in the command are not parsed by sendmail, but just fed directly to the
shell.  The standard input to /bin/sh is the message concerned.  The mailer
flags control the header lines added to the mail before pumping it into
/bin/sh.

 Hope that helps.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115.                                  +1-815-753-6940

carllp@rimfaxe.diku.dk (Carl-Lykke Pedersen) (10/30/90)

rickert@mp.cs.niu.edu (Neil Rickert) writes:
>  This means that everything following the '|' is just fed as an
>  argument to /bin/sh -c
>
>  In other words, any string valid for the -c option of /bin/sh should be
> ok.  As long as the command is quoted with ", the actual details of what is
> in the command are not parsed by sendmail, but just fed directly to the
> shell.

Note that sendmail may convert the string to lowercase, before feeding
it to /bin/sh.
It doesn't happen in all versions, but we have had problems with it.

Regards
Carl-Lykke

--
Carl-Lykke Pedersen (System Administrator)     Email:  carllp@diku.dk
DIKU (Dept. Comp. Sci. Univ. Copenhagen)       Fax:   +45 31 39 02 21
Universitetsparken 1
DK-2100 Copenhagen, Denmark					       

mills@ccu.umanitoba.ca (Gary Mills) (11/01/90)

In <1990Oct29.230614.4328@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:

> In other words, any string valid for the -c option of /bin/sh should be
>ok.  As long as the command is quoted with ", the actual details of what is
>in the command are not parsed by sendmail, but just fed directly to the
>shell.  The standard input to /bin/sh is the message concerned.  The mailer
>flags control the header lines added to the mail before pumping it into
>/bin/sh.

Watch out for the quoting requirements of /bin/sh.  I recently helped a user
who had "| /usr/local/lib/foo/mailer #user@host.dom.ain" in his .forward file.
I had to quote the `#' character to make it work.  It was a valid, albeit
unfortunate, address.
-- 
-Gary Mills-         -Networking Group-          -U of M Computer Services-

andy@jhunix.HCF.JHU.EDU (Andy S Poling) (11/19/90)

In article <1990Oct29.230614.4328@mp.cs.niu.edu> rickert@mp.cs.niu.edu (Neil Rickert) writes:
>In article <VICTOR.90Oct29151207@irt.watson.ibm.com> victor@arnor.uucp writes:
>>Can someone supply me with (or point me to) a FULL description of the
>>contents of .forward?
[...]
>
> .forward consists of a comma separated list of addresses.  It is permissible
>for one or more of those addresses to be programs, as in:
>"|program parameters".

It is also permissable to use the pathname of a file to which (if the file's
permissions are correct) the mail message will be appended.

-Andy

--
Andy Poling                              Internet: andy@gollum.hcf.jhu.edu
UNIX Systems Programmer                  Bitnet: ANDY@JHUNIX
Homewood Academic Computing              Voice: (301)338-8096    
Johns Hopkins University                 UUCP: uunet!mimsy!aplcen!jhunix!andy

Michael Barnett (11/22/90)

andy@jhunix.HCF.JHU.EDU (Andy S Poling) writes:


>It is also permissable to use the pathname of a file to which (if the file's
>permissions are correct) the mail message will be appended.

>-Andy

What about running shell scripts instead of programs from the .forward file?
I have tried this but have had no success at all.  Can someone please tell
me if this is possible at all.
-- 
          Michael Barnett s873561@minyos.xx.rmit.oz.au
                 RMIT/VUT, Melbourne, Australia
   "The opinions expressed here belong to whoever wants them" :-)  

rickert@mp.cs.niu.edu (Neil Rickert) (11/22/90)

In article <6306@minyos.xx.rmit.oz.au> Michael Barnett writes:
>What about running shell scripts instead of programs from the .forward file?
>I have tried this but have had no success at all.  Can someone please tell
>me if this is possible at all.
>-- 

 Of course.  In fact I would guess that most programs run from .forward
are shell scripts.

 In a standard setup, the program is run with: /bin/sh -c "command"
Check the definition of the 'prog' mailer in sendmail.cf to be sure.
As long as the script is valid for the shell, and DOES NOT depend on
any environment variables being preset, it should work.  (Best you
define PATH as the first statement of the script).

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert@cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115.                                  +1-815-753-6940