print a list of the bad addresses on returned email
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 15 Apr 1993 04:14:50 +0000 (20:14 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 15 Apr 1993 04:14:50 +0000 (20:14 -0800)
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 6.31

usr/src/usr.sbin/sendmail/src/savemail.c

index 69b59d8..5634fa2 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 6.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 6.31 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <pwd.h>
 #endif /* not lint */
 
 # include <pwd.h>
@@ -493,8 +493,10 @@ errbody(fp, m, e)
        register ENVELOPE *e;
 {
        register FILE *xfile;
        register ENVELOPE *e;
 {
        register FILE *xfile;
-       char buf[MAXLINE];
        char *p;
        char *p;
+       register ADDRESS *q;
+       bool printheader;
+       char buf[MAXLINE];
 
        if (e->e_parent == NULL)
        {
 
        if (e->e_parent == NULL)
        {
@@ -521,16 +523,38 @@ errbody(fp, m, e)
                                        putline(buf, fp, m);
                                }
                                (void) fclose(xfile);
                                        putline(buf, fp, m);
                                }
                                (void) fclose(xfile);
-                               fprintf(fp, "\n");
+                               putline("\n", fp, m);
                        }
                }
                else
                {
                        expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e);
                        putline(buf, fp, m);
                        }
                }
                else
                {
                        expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e);
                        putline(buf, fp, m);
-                       fprintf(fp, "\n");
+                       putline("\n", fp, m);
+               }
+       }
+
+       /*
+       **  Output message introduction
+       */
+
+       printheader = TRUE;
+       for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
+       {
+               if (bitset(QBADADDR, q->q_flags))
+               {
+                       if (printheader)
+                       {
+                               putline("The following addresses failed:\n",
+                                       fp, m);
+                               printheader = FALSE;
+                       }
+                       sprintf(buf, "\t%s\n", q->q_paddr);
+                       putline(buf, fp, m);
                }
        }
                }
        }
+       if (!printheader)
+               putline("\n", fp, m);
 
        /*
        **  Output transcript of errors
 
        /*
        **  Output transcript of errors
@@ -541,7 +565,7 @@ errbody(fp, m, e)
        if ((xfile = fopen(p, "r")) == NULL)
        {
                syserr("Cannot open %s", p);
        if ((xfile = fopen(p, "r")) == NULL)
        {
                syserr("Cannot open %s", p);
-               putline("  ----- Transcript of session is unavailable -----\n", fp, m);
+               putline("   ----- Transcript of session is unavailable -----\n", fp, m);
        }
        else
        {
        }
        else
        {