Index: courier-0.53.2/courier/module.dsn/dsn.c =================================================================== RCS file: /home/cvs/uwmail/sources/courier/courier-0.53.2/courier/module.dsn/dsn.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 dsn.c --- courier-0.53.2/courier/module.dsn/dsn.c 6 Jun 2006 08:38:08 -0000 1.1.1.1 +++ courier-0.53.2/courier/module.dsn/dsn.c 26 Sep 2006 09:31:26 -0000 @@ -704,6 +704,60 @@ return (0); } +static void print_header(FILE *f, char *template, const char *me, const char *from_time, const char *from_mta) +{ + unsigned char c, c2; + int i = 0; + + while ((c=template[i++]) > 0) { + char kw[64]; + if (c != '[') + { + fprintf(f,"%c", c); + continue; + } + + if ((c=template[i++]) != '#') + { + fprintf(f, "%c", '['); + continue; + } + c=template[i++]; + + c2=0; + while (c != 0 && (isalnum(c) || c == '_')) + { + if (c2 < sizeof(kw)-1) + kw[c2++]=c; + c=template[i++]; + } + kw[c2]=0; + + if (c != '#') + { + fprintf(f, "[#%s", kw); + continue; + } + + if ((c=template[i++]) != ']') + { + fprintf(f, "[#%s#", kw); + continue; + } + + if (strcmp(kw, "ME") == 0) + { + fprintf(f, "%s", me); + } + else if (strcmp(kw, "FROMTIME") == 0) + { + fprintf(f, "%s", from_time); + } + else if (strcmp(kw, "FROMMTA") == 0) + fprintf(f, "%s", from_mta); + } +} + static int dodsn(struct ctlfile *ctf, FILE *fp, const char *sender, int dodelayed) { @@ -799,7 +853,7 @@ from_time=rfc822_mkdate(stat_buf.st_mtime); - fprintf(fp, dsnheader, config_me(), from_time, + print_header(fp, dsnheader, config_me(), from_time, from_mta_p && *from_mta_p ? from_mta_p:"unknown"); if (dodelayed) Index: courier-0.53.2/courier/module.dsn/dsnheader.txt.in =================================================================== RCS file: /home/cvs/uwmail/sources/courier/courier-0.53.2/courier/module.dsn/dsnheader.txt.in,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 dsnheader.txt.in --- courier-0.53.2/courier/module.dsn/dsnheader.txt.in 6 Jun 2006 08:38:08 -0000 1.1.1.1 +++ courier-0.53.2/courier/module.dsn/dsnheader.txt.in 26 Sep 2006 10:07:29 -0000 @@ -1,8 +1,8 @@ Content-Type: text/plain; charset=us-ascii -This is a delivery status notification from %s, +This is a delivery status notification from [#ME#], running the Courier mail server, version @version@. -The original message was received on %s -from %s +The original message was received on [#FROMTIME#] +from [#FROMMTA#]