]> Pileus Git - ~andy/fetchmail/commitdiff
Added the `envelope' option.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 9 Dec 1996 04:17:32 +0000 (04:17 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 9 Dec 1996 04:17:32 +0000 (04:17 -0000)
svn path=/trunk/; revision=615

NEWS
driver.c
fetchmail.c
fetchmail.h
fetchmail.man
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/NEWS b/NEWS
index c551482fce918bed4b991ba09741c3b1995ad00f..666ac90423d4d0a5d436b2600b03970f05682bc7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,7 @@
                        Release Notes:
 
 ------------------------------------------------------------------------------
-fetchmail-2.2 (Fri Dec  6 18:45:42 EST 1996):
+fetchmail-2.2 (Sun Dec  8 23:17:01 EST 1996):
 
 features --
 
@@ -9,6 +9,11 @@ features --
   address is excluded by the local sendmail's spam filter.  Drop the mail.
   (This is the only circumstance in which mail is thrown away.)
 
+* The header your mailserver uses to convey envelope addresses is no longer
+  wired to `X-Envelope-Header'.  You can now specify it with the `envelope'
+  option in .fetchmailrc.  (This header is not RFC822 standard, and we have a
+  report of and ISP using X-Frontier-To).
+
 bugs --
 
 * Fixed a startup-time core dump introduced by 2.1's aka-list feature.
index 40851052fc37d421415b20f505a8697a2ef08e01..8d673078c37854b0fc460e6785a2468f366ea2b7 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -382,7 +382,7 @@ struct query *ctl;  /* query control record */
                tohdr = bufp;
            else if (!strncasecmp("Apparently-To:", bufp, 14))
                envto = bufp;
-           else if (!strncasecmp("X-Envelope-To:", bufp, 14))
+           else if (!strncasecmp(ctl->envelope, bufp, 14))
                envto = bufp;
            else if (!strncasecmp("Cc:", bufp, 3))
                cchdr = bufp;
index 9d64f963ac656bdbe27e903218f15f66aafa423f..617090e0fb4a85b511b3eac6c1e52e17801c4911 100644 (file)
@@ -565,6 +565,10 @@ static int load_params(int argc, char **argv, int optind)
            ctl->lead_server = ctl;
        no_new_server:;
 
+           /* plug in the semi-standard way of indicating a mail address */
+           if (ctl->envelope == (char *)NULL)
+               ctl->envelope = "X-Envelope-To:";
+
            /* sanity checks */
            if (ctl->port < 0)
            {
@@ -605,7 +609,7 @@ static int load_params(int argc, char **argv, int optind)
        initialize_saved_lists(querylist, idfile);
 
     /* if cmd_batchlimit was explicitly set, use it to override batchlimit */
-    if (cmd_batchlimit > -1)
+   if (cmd_batchlimit > -1)
        batchlimit = cmd_batchlimit;
 
     /* if cmd_logfile was explicitly set, use it to override logfile */
@@ -787,12 +791,15 @@ void dump_params (struct query *ctl)
        {
            for (idp = ctl->localnames; idp; idp = idp->next)
                if (idp->val.id2)
-                   fprintf(stderr, "\t%s -> %s\n", idp->id, idp->val.id2);
+                   printf("\t%s -> %s\n", idp->id, idp->val.id2);
                else
-                   fprintf(stderr, "\t%s\n", idp->id);
+                   printf("\t%s\n", idp->id);
            if (ctl->wildcard)
-               fputs("*\n", stderr);
+               fputs("*\n", stdout);
        }
+
+       if (count > 1)
+           printf("  Envelope header is assumed to be: %s\n", ctl->envelope);
     }
 
     if (ctl->protocol > P_POP2)
index 8c68e1a07109d72f566b20db9402bf1ac79fdf40..13b9791f4ee6296c747ea4b1b84b28ca6c5ab67e 100644 (file)
@@ -68,6 +68,7 @@ struct query
     int port;
     int authenticate;
     int timeout;
+    char *envelope;
     int skip;
 
     /* per-user data */
index 0326624d5e3cced579e3a3b626b2aa6f11a92c63..c98676d418e338f353fc342648d214bf843087fc 100644 (file)
@@ -441,6 +441,7 @@ Legal server options are:
     port
     authenticate (or auth)
     timeout
+    envelope
     aka
 
 Legal user options are
@@ -462,7 +463,7 @@ Legal user options are
     norewrite
 .PP
 All options correspond to the obvious command-line arguments except
-four: `aka', `is', `to', and `password'.
+four: `aka', `is', `to', `password', and `envelope'.
 .PP
 The `aka' option is for use with multidrop mailboxes.  It allows you
 to pre-declare a list of DNS aliases for a server.  This is an
@@ -472,6 +473,12 @@ while processing a multidrop mailbox, grovels through message headers
 looking for names of the mailserver, pre-declaring common ones can
 save it from having to do DNS lookups.
 .PP
+The `envelope' option changes the header 
+.I fetchmail
+assumes will carry a copy of the mail's envelope address.  Normally
+this is `X-Envelope-To' but as this header is not standard practice
+varies. See the discussion of multidrop address handling below.
+.PP
 The `is' or `to' keywords associate the following local (client)
 name(s) (or server-name to client-name mappings separated by =) with
 the mailserver user name in the entry.  If an is/to list has `*' as
@@ -690,6 +697,11 @@ and the item of mail had just one recipient, the MTA will have written
 a `for' clause that gives the envelope addressee into its Received
 header. But this doesn't work for other MTAs, nor if there is more
 than one recipient.
+.PP
+Alternatively, some SMTP listeners and/or mail servers insert a header
+in each message containing a copy of the envelope addresses.  This
+header (when it exists) is often `X-Envelope-To'.  Fetchmail's
+assumption about this can be changed with the `envelope' option.
 .SH EXIT CODES
 To facilitate the use of 
 .I fetchmail
index a48b97d82370e6e0ac450c377115a80c7f33ed81..27b7d5d11447e6c36008ed449e0171759d2250a0 100644 (file)
@@ -32,6 +32,7 @@ port          { return PORT; }
 auth(enticate)?        { return AUTHENTICATE; }
 kerberos       { return KERBEROS; }
 timeout                { return TIMEOUT;}
+envelope       { return ENVELOPE; }
 
 user(name)?    { return USERNAME; }
 pass(word)?    { return PASSWORD; }
index 725a7587b4feb43c5f6af562d5029b5419633c98..ed9e9223d20d7842def6e5fb647ed8d95b3be837 100644 (file)
@@ -42,7 +42,7 @@ static void prc_reset();
 }
 
 %token DEFAULTS POLL SKIP AKA PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
-%token USERNAME PASSWORD FOLDER SMTPHOST MDA LIMIT
+%token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA LIMIT
 %token IS HERE THERE TO MAP WILDCARD
 %token SET BATCHLIMIT LOGFILE
 %token <proto> PROTO
@@ -107,6 +107,7 @@ serv_option : AKA alias_list
                | AUTHENTICATE PASSWORD {current.authenticate = A_PASSWORD;}
                | AUTHENTICATE KERBEROS {current.authenticate = A_KERBEROS;}
                | TIMEOUT NUMBER        {current.timeout = $2;}
+               | ENVELOPE STRING       {current.envelope = xstrdup($2);}
                ;
 
 /*
index 58711c77ecef49cd0e6e6ae54cd1820d5e339b7a..a56632fa15deb22ace9e8eba058ca3e656bbb639 100644 (file)
@@ -25,6 +25,7 @@
 #   port                      -- must be followed by a TCP/IP port number
 #   authenticate (or auth)    -- must be followed by an authentication type
 #   timeout                   -- must be followed by a numeric timeout value
+#   envelope                  -- must be followed by an envelope header name
 #   aka                       -- must be followed by one or more server aliases
 #
 #   username (or user)        -- must be followed by a name