Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!usc!sdsu!ucsdhub!hp-sdd!ncr-sd!ncrlnk!wright!thor.wright.edu From: jsloan@thor.wright.edu (John Sloan) Newsgroups: comp.mail.sendmail Subject: Re: Keeping mail in the queue when mail cannot be delivered Message-ID: <582@thor.wright.EDU> Date: 22 Jun 89 15:10:33 GMT References: Sender: news@wright.EDU Reply-To: jsloan@thor.wright.edu Lines: 143 From article , by karl@giza.cis.ohio-state.edu (Karl Kleinpaste): > To cause sendmail to re-queue a piece of mail, the Mmailer called > should exit(EX_TEMPFAIL). From : > A For mailers which are too brain damaged to do this, like the Ultrix/DECnet mail11, which takes the rather rude approach in emulating VMS mail11 in that if it can't make a network connection immediately, it throws away your email, you can wrap another program around your mailer and then call the wrapper from Sendmail. e.g. /* ** D N E T M A I L ** ** Module dnetmail ** Author jsloan@CS.Wright.EDU ** Project DECnet/Ultrix ** System Ultrix-32 ** Date 18Jun1986 ** Modifications ** ** 17Apr1987 jsloan improved exit statuses ** 18Jun1987 jsloan added more debugging stuff ** ** Abstract ** ** Frontend which sits betweem Sendmail and Mail11. ** Rewrites user address(es), replacing '_' with '$'. ** This is done because VMS allows $s in user names, ** but Sendmail uses '$' internally. Hack hack hack. ** Does not correct headers, so meaningful internet ** routing is difficult. Does not handle multiple ** users dues to laziness of author. ** ** Now returns more meaningful statuses to Sendmail than ** possible with Mail11. ** ** Dnetmail will keep a trace of messages for debugging ** purposes in the file /tmp/DECnetTrace provided the ** file already exists. This feature is compiled in only ** if DEBUG is defined. ** ** Compile with something similar to ** ** cc -O -o dnetmail dnetmail.c ** strip dnetmail ** cp dnetmail /usr/local/mail ** ** Called from Sendmail as ** ** dnetmail from name to user < message ** */ static char header[]="@(#) dnetmail.c version 1.2 from 88/01/27 by jsloan@SPOTS.Wright.Edu"; #include #include #include #define TRACE "/tmp/DECnetTrace" #define MAIL11 "/usr/bin/mail11 \'%s\' \'%s\' \'%s\' \'%s\'" #define OLD '_' #define NEW '$' extern char *malloc(), *strcopy(), *strcat(); extern int strlen(); extern FILE *popen(); extern int pclose(); main(argc,argv) int argc; char **argv; { char *from, *name, *to, *user, command[512], work[512]; FILE *trace, *pipefd; int index, status; #ifdef DEBUG if ((trace=fopen(TRACE,"r"))!=NULL) { fclose(trace); trace = fopen(TRACE,"a"); } #endif if (argc != 5) { fprintf(stderr,"dnetmail: %d arguments, exit %d\n",argc,EX_USAGE); exit(EX_USAGE); } from = argv[1]; name = argv[2]; to = argv[3]; user = argv[4]; for (index = 0; index <= strlen(user); index++) if (user[index] == OLD) user[index] = NEW; sprintf(command,MAIL11,from,name,to,user); #ifdef DEBUG if (trace != NULL) fprintf(trace,"DNETMAIL exec \"%s\"\n",command); #endif pipefd = popen(command,"w"); if (pipefd == NULL) { fprintf(stderr,"dnetmail: popen failed, exit %d\n",EX_OSERR); exit(EX_OSERR); } while (fgets(work,sizeof(work),stdin)) { fputs(work,pipefd); #ifdef DEBUG if (trace != NULL) fputs(work,trace); #endif } if ((status = pclose(pipefd)) != 0) { fprintf(stderr,"dnetmail: mail11 status %d, exit %d\n",status,EX_TEMPFAIL); fprintf(stderr,"dnetmail: \"%s\" \"%s\" \"%s\" \"%s\"\n",from,name,to,user); exit(EX_TEMPFAIL); } exit(EX_OK); } ---------- Since the wrapper can't discriminate between unreachable hosts and non-existent users (because the mailer just says "it didn't work"), it will cause sendmail to reattempt delivery until the timeout period specified in the cf is reached. Maybe that's not so bad... if a user is finally defined on the target system prior to expiration of the timeout, deliverly will eventually be successful. Man page available upon request. John Sloan +1 513 259 1384 jsloan%spots.wright.edu@relay.cs.net Wright State University Research Center ...!uunet!ncrlnk!wright!jsloan 3171 Research Blvd., Kettering, OH 45420 ...!osu-cis!wright!jsloan Logical Disclaimer: belong(opinions,jsloan). belong(opinions,_):-!,fail.