[comp.mail.sendmail] Writing a mailer

rrr@u02.svl.cdc.com (Rich Ragan) (11/13/90)

I am writing a mailer to act as a gateway between mail on
unix and a proprietary mail system. I have changed the
sendmail.cf file so that properly addressed mail get sent
to my mailer by sendmail. My questions revolve around
error conditions.
  1) How can I stave off sendmail calling my mailer
     if it can only send have one connection at a time
     to the proprietary system?
  2) How do I stave it off if the proprietary system
     is down? Who hangs onto the mail until it can
     be sent?
  3) How should I return errors in outbound mail.
     I'm currently mailing them back to the sender.
  4) anything else a well-behaved mailer should do
     in polite society.
Thanks in advance
--
Richard R. Ragan  rrr@svl.cdc.com  (408) 496-4340 
Control Data Corporation--Silicon Valley Operations

paul@uxc.cso.uiuc.edu (Paul Pomes - UofIllinois CSO) (11/13/90)

rrr@u02.svl.cdc.com (Rich Ragan) writes:

>I am writing a mailer to act as a gateway between mail on
>unix and a proprietary mail system. I have changed the
>sendmail.cf file so that properly addressed mail get sent
>to my mailer by sendmail. My questions revolve around
>error conditions.
>  1) How can I stave off sendmail calling my mailer
>     if it can only send have one connection at a time
>     to the proprietary system?

Have the mailer return ECONNREFUSED once it detects another instance of itself.
I assume you have some mechanism to detect this, either lock files or the use
of lockf()/flock() on a common file.  Marking the mailer as expensive ('e'
flag) will cause incoming messages to be queued.  When a queue run is started,
the messages will be handed one at a time to the mailer.

>  2) How do I stave it off if the proprietary system
>     is down? Who hangs onto the mail until it can
>     be sent?

Again return ECONNREFUSED.  If this occurs during a queue run, sendmail will
defer on the remaining addresses to the same destination.

>  3) How should I return errors in outbound mail.
>     I'm currently mailing them back to the sender.

Have the mailer exit with an appropriate status from <sysexits.h>.  More
exact messages can be supplied if your mailer talks SMTP with sendmail.

>  4) anything else a well-behaved mailer should do in polite society.

Don't core dump :-)  The robustness principle applies: be liberal in what
you accept, conservative in what you send out.

/pbp
--
         Paul Pomes

UUCP: {att,iuvax,uunet}!uiucuxc!paul   Internet, BITNET: paul@uxc.cso.uiuc.edu
US Mail:  UofIllinois, CSO, 1304 W Springfield Ave, Urbana, IL  61801-2910