Subject: Changing the FROm: line on outgoing mail?

From: Thorvald Natvig <[email-masked]>
Date: Thu, 17 Aug 1995 23:54:04 +0100

Is there ia way in Pine 3.91 to change the From: line on outgoing mail? 
Adding it as a customized headre want do, and changing the from: line is 
certainly easier for the reciever than having a reply-to line.
If not in Pine, can I change my Sendmail config to do it?

Ohm in case it doesn't work: Rply-to: [email-masked]

---

From: [email-masked] (Christian Mondrup)
Date: 18 Aug 1995 07:34:35 GMT

Thorvald Natvig ([email-masked]) wrote:
: Is there ia way in Pine 3.91 to change the From: line on outgoing mail? 
: Adding it as a customized headre want do, and changing the from: line is 
: certainly easier for the reciever than having a reply-to line.
: If not in Pine, can I change my Sendmail config to do it?

: Ohm in case it doesn't work: Rply-to: [email-masked]

The method to do this is described in Pine Technical Notes, Section 7.

Find the distribution file pine3.91/pine/osdep/os-xxx.h and remove the 
commentary char from the line:

#define ALLOW_CHANGING_FROM  /* comment out to not allow changing From */

and then recompile pine.

Then you may set up your mail headers including From: from within the Pine 
setup menu.

--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+      Christian Mondrup                                                      +
+      UNI-C Aarhus, Danish Computing Centre for Research and Education.      +
+      Olof Palmes Alle 38, DK 8200 Aarhus N.                                 +
+                                                                             +
+      Phone:   +45 86 78 44 44                                               +
+      Telefax: +45 86 78 44 55                                               +
+      E-Mail:  [email-masked]                                    +
+                                                                             +
+      Opinions expressed are mine and do not reflect those of my employer.   +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

---

From: [email-masked] (Jerry Lynch)
Date: 18 Aug 1995 12:44:27 -0400

You can have pine change the FROM line as a customized header IF that 
functionality is compiled into pine.  The file you need to change is: 

pine3.91/pine/osdep/os-xxx.h

Just change the flag ALLOW_CHANGING_FROM and recompile.

Or, you can have sendmail do this by using the sendmail USERDB option.  
However, for the USERDB option to work with pine, a little more work is 
involved than what the sendmail docs describe, since sendmail expects 
mail to be changed by the database to be of the from "FROM: user" instead 
of pine's default of "FROM: user@localhost".  Maybe 3.92 will have a 
configuration option to fix this? (HOPEFULLY!)  But until then, you can 
do the following:

Compile sendmail with Berkley's USERDB option defined.  (If your running 
Linux, you can get a precompiled binary from 
lss.afit.af.mil:/pub/Linux/system/Mail/delivery/sendmail-8.6.12b-bin.tgz)

Replace your existing sendmail and makemap binaries with the new ones.

Then follow the instructions included in that to set it up with the 
USERDB feature, or, follow the below from the FAQ:
----------------------------------------------------------------------
  * How do I rewrite my From: lines to read [email-masked]''?

        There are a couple of ways of doing this.  This describes using
        the "user database" code.  This is still experimental, and was
        intended for a different purpose -- however, it does work
        with a bit of care.  It does require that you have the Berkeley
        "db" package installed (it won't work with DBM).

        First, create your input file.  This should have lines like:

                loginname:mailname      First_Last
                First_Last:maildrop     loginname

        Install it in (say) /etc/userdb.  Create the database:

                makemap btree /etc/userdb.db < /etc/userdb
----------------------------------------------------------------------
In your /etc/sendmail.cf file, add the following line before the 
rulesets.  (I put mine right after the line saying "Kdequote dequote" and 
before the "Special Macros" section"):

# Define our userdb file for pine rewrites
Kuserdb btree -o /etc/userdb.db

Then, add the following ruleset #1.  (I put mine right after Ruleset 0):

##################################################
### Ruleset 1, rewrite sender header & envelope ##
##################################################
#Thanks to Bjart Kvarme <[email-masked]>
S1
R$- < @ $=w . > $*      $: $1 < @ $2 . > $3 ?? $1       username@localhost ?
R$+ ?? $+               $: $1 ?? $(userdb $2 : mailname $: @ $)
R$+ ?? @                $@ $1                           Not found
R$+ ?? $+               $>3 $2                          Found, rewrite

#NOTE      ^^^^^^^^^^^^^       ^^^^^^^^^^^^^^^^^^^^^^^^^
#          Use Tab Characters  Use Tab Characters in these regions
# to make three columns (the line with "mailname" only has 2 columns).

This is how mine is set up and it works great without having to alter 
pine's code.

Also, if you have a "SLIP" or "PPP" connection, another good thing to do 
in the /etc/sendmail.cf file is to move the line for the nameserver 
lookup in ruleset 96 to the bottom of the ruleset so that your local mail 
can be delivered even when you don't have a connection to a nameserver.  
The key two lines to move to the bottom of the ruleset are:

# pass to name server to make hostname canonical
R$* < @ $* $~P > $*             $: $1 < @ $[ $2 $3 $] > $4

Obviously, recompiling pine would be the easiest solution.  The benefit 
of fixing up sendmail to do this is that your mail will always have the 
correct from line regardless of which mailer you use (pine, elm, mh).  
Another plus is that your sent-mail folder will continue to say 
"TO: whomever" instead of just filling the from column with your name.

Hope this helps.

        Jerry