[comp.mail.uucp] Using SMTP and smail

sean@utoday.UUCP (Sean Fulton) (09/21/90)

I think I recently read that smail 2.5 was suitable for UUCP mail, but
that to run smail using SMTP I would need smail3.19 (with smail 3.2 not
available yet).

I already have smail2.5 installed and running fine, but we're planning
to add an Ethernet link to a machine in the next office within a
month. I want to run SMTP, since the other site might not be a Unix
site.

So, do I have to go up to smail 3.19, and if so, how soon can I expect
3.2?
-- 
Sean Fulton					sean@utoday.com
UNIX Today!					(516) 562-5430
 /* The opinions expressed above are not those of my employer */

chip@chinacat.Unicom.COM (Chip Rosenthal) (09/23/90)

In article <1808@utoday.UUCP> sean@utoday.UUCP (Sean Fulton) writes:
>I think I recently read that smail 2.5 was suitable for UUCP mail, but
>that to run smail using SMTP I would need smail3.19 (with smail 3.2 not
>available yet).

The problem is that smail 2.5 does not have any delivery support - it
needs to pass of the message to another program to perform the actual
delivery.  I guess a second problem is that smail 2.5 makes the naive
assumption that there are only two delivery channels:  uucp and local.

None the less, if you've got a program which will do the delivery, you
can still use smail2.5.  For example, when I was running the Excelan LAN
Workplace under XENIX, I was able to wedge their crufty SMTP into smail.
The key to this was using Chip Salzenberg's "deliver" program (available
at finer archives everywhere).

The trick was to use a little-known feature of pathalias, which allows
you to put a network character (e.g. ``%'') into the routing data to get
something other than the default bang path.  Smail assumes that a bang
path should go to the uucp delivery agent (i.e. uux) and everything else
goes to the local delivery agent (in my case, deliver).  I then trained
deliver to pass ``%'' messages off to SMTP (a simple matter of shell
programming).

Some things have changed since that time.  i.e. my smail2.5 is now
trained to handle ``%'' addresses, and deliver can be used as smail's
uucp delivery agent as well as the local delivery agent.  Just the
same, the number of wonderfully perverse things you can do with smail2.5
and deliver are mind boggling.

With all that said and done, whenever I get the network up and running
here, I probably won't repeat the above approach.  I'll probably bring
up smail3 and use it's SMTP capabiilty.

-- 
Chip Rosenthal  <chip@chinacat.Unicom.COM>
Unicom Systems Development, 512-482-8260 
Our motto is:  We never say, "But it works with DOS."

peter@ficc.ferranti.com (Peter da Silva) (09/24/90)

In article <1588@chinacat.Unicom.COM> chip@chinacat.Unicom.COM (Chip Rosenthal) writes:
> The problem is that smail 2.5 does not have any delivery support - it
> needs to pass of the message to another program to perform the actual
> delivery.  I guess a second problem is that smail 2.5 makes the naive
> assumption that there are only two delivery channels:  uucp and local.

The best solution to this problem is to tell smail that the uucp
delivery agent is some program you specify (I stick mine in
/usr/lib/smail/router), and have it figure out the actual juju to
do the real delivery.

/*
**  Defs.h:  header file for rmail/smail.
...
*/

#define ROUTER "/usr/lib/smail/router" /* Command to route !oid mail */
#define DELIVER "/usr/lib/smail/deliver" /* Command to deliver local mail */

...

#define RMAIL(flags,from,sys) "%s %s %s %s",ROUTER,flags,from,sys /* */

#define RARG(user)		" '%s'",user

Router itself can be a simple shell script or a quicky C program. I have
it read /usr/lib/smail/routes to get the name of the program to use for
actual delivery. I default to UUCP, and I've set up several "pseudo"
sites, such as the following script that send to all members of a group:

#!/bin/sh
#
# Arguments passed in the environment: FLAGS, FROM, SYS, USERS
REAL_USERS=
BAD_GROUPS=
G_FMT="group:passwd:gid:users"
G=/etc/group

for USER in $USERS
do
  _USERS="`carve $G_FMT group==$USER users -f $G | sed 's/,/ /g'`"
  if [ ! "$_USERS" ]
  then
    BAD_GROUPS="$BAD_GROUPS $USER"
  else
    REAL_USERS="$REAL_USERS $_USERS"
  fi
done

if [ ! "$REAL_USERS" ]
then
  {
    echo "Your mail to $USERS was not sent. No valid groups were found."
    echo ""
    echo "Contents of bounced mail:"
    echo "=========="
    cat
  } | mail -s "No such group(s): $BAD_GROUPS" $FROM
  exit 0
fi

if [ "$BAD_GROUPS" ]
then
  {
    echo "Your mail to $USERS did not get to all the listed groups"
  } | mail -s "No such group(s): $BAD_GROUPS" $FROM
fi

smail -F $FROM $REAL_USERS
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.   'U`
peter@ferranti.com

les@chinet.chi.il.us (Leslie Mikesell) (09/27/90)

In article <YO:58A4@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
[smail 2.5 delivery agent]
>Router itself can be a simple shell script or a quicky C program.

Is it safe to let a shell script handle arbitrary addresses passed by
smail 2.5 or can you get shell metacharacters in there with the right
quoting?

Les Mikesell
  les@chinet.chi.il.us

tneff@bfmny0.BFM.COM (Tom Neff) (09/27/90)

In article <1990Sep26.202956.11734@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes:
>Is it safe to let a shell script handle arbitrary addresses passed by
>smail 2.5 or can you get shell metacharacters in there with the right
>quoting?

It's safe in the sense that the script will inherit the right addresses,
however quirky, since smail2 uses execvp() to start the deliverer.  (If
it used execlp() and made the shell parse its own arguments, there would
be trouble.)  But it certainly is responsibility of the routing or
delivering shell script to keep things "honest" afterwards, by enclosing
variable names in quotes etc. to protect spaces.  I have done this with
Deliver (the perfect companion package to smail2) and it works OK.

-- 
You are sunlight and I, moon     |
Joined by the gods of fortune    |
Midnight and high noon           |
Sharing the sky                  |  Tom Neff
We have been blessed, you and I  |  tneff@bfmny0.bfm.com

tneff@bfmny0.BFM.COM (Tom Neff) (09/28/90)

In article <15889@bfmny0.BFM.COM> I wrote:
>It's safe in the sense that the script will inherit the right addresses,
>however quirky, since smail2 uses execvp() to start the deliverer.  (If
>it used execlp() and made the shell parse its own arguments, there would
         ^^^^^^^^
>be trouble.)  

I meant system().  After lecturing others to read their own postings
before inflicting them on the world, I am hoist on my petard!  :-)

Thanks to R. for catching this.

-- 
"The thought of being President frightens me and I    @-@  Tom Neff
do not think I want the job." -- Ronald Reagan, 1973  \_/  tneff@bfmny0.BFM.COM

chip@tct.uucp (Chip Salzenberg) (10/01/90)

According to les@chinet.chi.il.us (Leslie Mikesell):
>Is it safe to let a shell script handle arbitrary addresses passed by
>smail 2.5 or can you get shell metacharacters in there with the right
>quoting?

A carefully-written shell script, or a Perl script, can handle
metacharacters in addresses.

Incidentally, Deliver rejects any addresses with shell metacharacters
before they become delivery script arguments.
-- 
Chip Salzenberg at Teltronics/TCT     <chip@tct.uucp>, <uunet!pdn!tct!chip>