ph10 2007/02/06 11:11:40 GMT
Modified files:
exim-doc/doc-txt ChangeLog NewStuff
exim-src/src deliver.c functions.h globals.c globals.h
macros.h moan.c readconf.c
exim-test/confs 0032
exim-test/mail 0032.CALLER
Log:
Added dsn_from to vary the contents of From: in DSNs
Revision Changes Path
1.470 +2 -0 exim/exim-doc/doc-txt/ChangeLog
1.137 +10 -0 exim/exim-doc/doc-txt/NewStuff
1.43 +3 -7 exim/exim-src/src/deliver.c
1.35 +1 -0 exim/exim-src/src/functions.h
1.70 +5 -1 exim/exim-src/src/globals.c
1.50 +2 -0 exim/exim-src/src/globals.h
1.32 +4 -0 exim/exim-src/src/macros.h
1.8 +31 -6 exim/exim-src/src/moan.c
1.29 +1 -0 exim/exim-src/src/readconf.c
1.2 +1 -0 exim/exim-test/confs/0032
1.2 +1 -1 exim/exim-test/mail/0032.CALLER
Index: ChangeLog
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/ChangeLog,v
retrieving revision 1.469
retrieving revision 1.470
diff -u -r1.469 -r1.470
--- ChangeLog 6 Feb 2007 10:00:24 -0000 1.469
+++ ChangeLog 6 Feb 2007 11:11:39 -0000 1.470
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.469 2007/02/06 10:00:24 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/ChangeLog,v 1.470 2007/02/06 11:11:39 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
@@ -74,6 +74,8 @@
PH/15 Flush SMTP output before delaying, unless control=no_delay_flush is set.
PH/16 Add ${if forany and ${if forall.
+
+PH/17 Added dsn_from option to vary the From: line in DSNs.
Exim version 4.66
Index: NewStuff
===================================================================
RCS file: /home/cvs/exim/exim-doc/doc-txt/NewStuff,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -r1.136 -r1.137
--- NewStuff 6 Feb 2007 10:00:24 -0000 1.136
+++ NewStuff 6 Feb 2007 11:11:39 -0000 1.137
@@ -1,4 +1,4 @@
-$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.136 2007/02/06 10:00:24 ph10 Exp $
+$Cambridge: exim/exim-doc/doc-txt/NewStuff,v 1.137 2007/02/06 11:11:39 ph10 Exp $
New Features in Exim
--------------------
@@ -267,6 +267,16 @@
Outside a forany/forall condition, the value of $item is an empty string.
Its value is saved and restored while forany/forall is being processed, to
enable these expansion items to be nested.
+
+13. There's a new global option called dsn_from that can be used to vary the
+ contents of From: lines in bounces and other automatically generated
+ messages ("delivery status notifications" - hence the name of the option).
+ The default setting is:
+
+ dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain>
+
+ The value is expanded every time it is needed. If the expansion fails, a
+ panic is logged, and the default setting is used.
Version 4.66
Index: deliver.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/deliver.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- deliver.c 23 Jan 2007 12:33:08 -0000 1.42
+++ deliver.c 6 Feb 2007 11:11:40 -0000 1.43
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/deliver.c,v 1.42 2007/01/23 12:33:08 magnus Exp $ */
+/* $Cambridge: exim/exim-src/src/deliver.c,v 1.43 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2043,9 +2043,7 @@
!contains_header(US"Reply-To", warn_message))
fprintf(f, "Reply-To: %s\n", errors_reply_to);
fprintf(f, "Auto-Submitted: auto-replied\n");
- if (!contains_header(US"From", warn_message))
- fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+ if (!contains_header(US"From", warn_message)) moan_write_from(f);
fprintf(f, "%s", CS warn_message);
/* Close and wait for child process to complete, without a timeout. */
@@ -6248,8 +6246,7 @@
if (errors_reply_to != NULL)
fprintf(f, "Reply-To: %s\n", errors_reply_to);
fprintf(f, "Auto-Submitted: auto-replied\n");
- fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+ moan_write_from(f);
fprintf(f, "To: %s\n", bounce_recipient);
/* Open a template file if one is provided. Log failure to open, but
@@ -6773,8 +6770,7 @@
if (errors_reply_to != NULL)
fprintf(f, "Reply-To: %s\n", errors_reply_to);
fprintf(f, "Auto-Submitted: auto-replied\n");
- fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+ moan_write_from(f);
fprintf(f, "To: %s\n", recipients);
wmf_text = next_emf(wmf, US"header");
Index: functions.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/functions.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- functions.h 18 Jan 2007 15:35:42 -0000 1.34
+++ functions.h 6 Feb 2007 11:11:40 -0000 1.35
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/functions.h,v 1.34 2007/01/18 15:35:42 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/functions.h,v 1.35 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -170,6 +170,7 @@
extern void moan_tell_someone(uschar *, address_item *, uschar *, char *,
...);
extern BOOL moan_to_sender(int, error_block *, header_line *, FILE *, BOOL);
+extern void moan_write_from(FILE *);
extern FILE *modefopen(uschar *, char *, mode_t);
extern uschar *parse_extract_address(uschar *, uschar **, int *, int *, int *,
Index: globals.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- globals.c 6 Feb 2007 10:00:24 -0000 1.69
+++ globals.c 6 Feb 2007 11:11:40 -0000 1.70
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.c,v 1.69 2007/02/06 10:00:24 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.c,v 1.70 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -526,6 +526,7 @@
BOOL dont_deliver = FALSE;
BOOL dot_ends = TRUE;
BOOL drop_cr = FALSE; /* No longer used */
+uschar *dsn_from = US DEFAULT_DSN_FROM;
BOOL enable_dollar_recipients = FALSE;
BOOL envelope_to_remove = TRUE;
@@ -551,7 +552,10 @@
uschar *extra_local_interfaces = NULL;
int fake_response = OK;
-uschar *fake_response_text = US"Your message has been rejected but is being kept for evaluation.\nIf it was a legitimate message, it may still be delivered to the target recipient(s).";
+uschar *fake_response_text = US"Your message has been rejected but is "
+ "being kept for evaluation.\nIf it was a "
+ "legitimate message, it may still be "
+ "delivered to the target recipient(s).";
int filter_n[FILTER_VARIABLE_COUNT];
BOOL filter_running = FALSE;
int filter_sn[FILTER_VARIABLE_COUNT];
Index: globals.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/globals.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- globals.h 6 Feb 2007 10:00:24 -0000 1.49
+++ globals.h 6 Feb 2007 11:11:40 -0000 1.50
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/globals.h,v 1.49 2007/02/06 10:00:24 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/globals.h,v 1.50 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -307,6 +307,8 @@
/* This option is now a no-opt, retained for compatibility */
extern BOOL drop_cr; /* For broken local MUAs */
+
+extern uschar *dsn_from; /* From: string for DSNs */
extern BOOL enable_dollar_recipients; /* Make $recipients available */
extern int envelope_to_remove; /* Remove envelope_to_headers */
Index: macros.h
===================================================================
RCS file: /home/cvs/exim/exim-src/src/macros.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- macros.h 31 Jan 2007 16:52:12 -0000 1.31
+++ macros.h 6 Feb 2007 11:11:40 -0000 1.32
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/macros.h,v 1.31 2007/01/31 16:52:12 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/macros.h,v 1.32 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -96,6 +96,10 @@
#define DEBUG(x) if ((debug_selector & (x)) != 0)
#define HDEBUG(x) if (host_checking || (debug_selector & (x)) != 0)
+
+/* The default From: text for DSNs */
+
+#define DEFAULT_DSN_FROM "Mail Delivery System <Mailer-Daemon@$qualify_domain>"
/* The size of the vector for saving/restoring address expansion pointers while
verifying. This has to be explicit because it is referenced in more than one
Index: moan.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/moan.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- moan.c 8 Jan 2007 10:50:18 -0000 1.7
+++ moan.c 6 Feb 2007 11:11:40 -0000 1.8
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/moan.c,v 1.7 2007/01/08 10:50:18 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/moan.c,v 1.8 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -15,6 +15,34 @@
/*************************************************
+* Write From: line for DSN *
+*************************************************/
+
+/* This function is called to write the From: line in automatically generated
+messages - bounces, warnings, etc. It expands a configuration item in order to
+get the text. If the expansion fails, a panic is logged and the default value
+for the option is used.
+
+Argument: the FILE to write to
+Returns: nothing
+*/
+
+void
+moan_write_from(FILE *f)
+{
+uschar *s = expand_string(dsn_from);
+if (s == NULL)
+ {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "Failed to expand dsn_from (using default): %s", expand_string_message);
+ s = expand_string(US DEFAULT_DSN_FROM);
+ }
+fprintf(f, "From: %s\n", s);
+}
+
+
+
+/*************************************************
* Send error message *
*************************************************/
@@ -62,8 +90,7 @@
f = fdopen(fd, "wb");
if (errors_reply_to != NULL) fprintf(f, "Reply-To: %s\n", errors_reply_to);
fprintf(f, "Auto-Submitted: auto-replied\n");
-fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+moan_write_from(f);
fprintf(f, "To: %s\n", recipient);
switch(ident)
@@ -427,8 +454,7 @@
f = fdopen(fd, "wb");
fprintf(f, "Auto-Submitted: auto-replied\n");
-fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+moan_write_from(f);
fprintf(f, "To: %s\n", who);
fprintf(f, "Subject: %s\n\n", subject);
va_start(ap, format);
@@ -671,8 +697,7 @@
f = fdopen(fd, "wb");
fprintf(f, "Auto-Submitted: auto-replied\n");
-fprintf(f, "From: Mail Delivery System <Mailer-Daemon@%s>\n",
- qualify_domain_sender);
+moan_write_from(f);
fprintf(f, "To: %s\n", s);
fprintf(f, "Subject: error(s) in forwarding or filtering\n\n");
Index: readconf.c
===================================================================
RCS file: /home/cvs/exim/exim-src/src/readconf.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- readconf.c 22 Jan 2007 16:29:54 -0000 1.28
+++ readconf.c 6 Feb 2007 11:11:40 -0000 1.29
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/exim-src/src/readconf.c,v 1.28 2007/01/22 16:29:54 ph10 Exp $ */
+/* $Cambridge: exim/exim-src/src/readconf.c,v 1.29 2007/02/06 11:11:40 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -209,6 +209,7 @@
/* This option is now a no-op, retained for compability */
{ "drop_cr", opt_bool, &drop_cr },
/*********************************************************/
+ { "dsn_from", opt_stringptr, &dsn_from },
{ "envelope_to_remove", opt_bool, &envelope_to_remove },
{ "errors_copy", opt_stringptr, &errors_copy },
{ "errors_reply_to", opt_stringptr, &errors_reply_to },
Index: 0032
===================================================================
RCS file: /home/cvs/exim/exim-test/confs/0032,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0032 7 Feb 2006 10:34:25 -0000 1.1
+++ 0032 6 Feb 2007 11:11:40 -0000 1.2
@@ -12,6 +12,7 @@
# ----- Main settings -----
+dsn_from = MailProgram <xyz@???>
# ----- Routers -----
Index: 0032.CALLER
===================================================================
RCS file: /home/cvs/exim/exim-test/mail/0032.CALLER,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 0032.CALLER 7 Feb 2006 10:34:59 -0000 1.1
+++ 0032.CALLER 6 Feb 2007 11:11:40 -0000 1.2
@@ -7,7 +7,7 @@
for CALLER@???; Tue, 2 Mar 1999 09:44:33 +0000
X-Failed-Recipients: userx@???
Auto-Submitted: auto-replied
-From: Mail Delivery System <Mailer-Daemon@???>
+From: MailProgram <xyz@???>
To: CALLER@???
Subject: Mail delivery failed: returning message to sender
Message-Id: <E10HmaY-0005vi-00@???>