9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] How to over ride /mail/box/bwc/headers file with Acme/Mail?
@ 2004-04-03 16:29 Brantley Coile
  2004-04-03 17:20 ` Russ Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Brantley Coile @ 2004-04-03 16:29 UTC (permalink / raw)
  To: 9fans

I put `From: bwc@prepaynt.com' for example right after the To: line
in the Mail window in acme, but both that and the From: line from
the headers file in my mail/box directory shows up.  How to I keep that
from happening?  Or am I the odd man again?

Thanks

 Brantley




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9fans] How to over ride /mail/box/bwc/headers file with Acme/Mail?
  2004-04-03 16:29 [9fans] How to over ride /mail/box/bwc/headers file with Acme/Mail? Brantley Coile
@ 2004-04-03 17:20 ` Russ Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2004-04-03 17:20 UTC (permalink / raw)
  To: 9fans

Brantley Coile wrote:

>I put `From: bwc@prepaynt.com' for example right after the To: line
>in the Mail window in acme, but both that and the From: line from
>the headers file in my mail/box directory shows up.  How to I keep that
>from happening?  Or am I the odd man again?
>  
>

You can't override /mail/box/$user/headers.  They're always added.
I'm surprised that both showed up in your mail.  Acme Mail used
to rewrite From: as To: (to handle the case where you reply by
just editing the original message and click Post).  I thought it
still did.

I used to use the following pipefrom to change my From: line
on outgoing mail based on who it was going to, so that for
example mail to anyone at *.mit.edu would be from rsc@mit.edu.
This generally reduced confusion for receivers, and it was much
easier than having to change my From: address in every message
(like I used to do with mh on Unix).  I haven't found a good way
to do this with my current mail reader (thunderbird on Unix) so
now all my mail says rsc@swtch.com.

If a message was being sent in reply to another message, the script used
the To: address on the original, assuming it was one of my aliases.
This worked well for replying to 9trouble mail from 9trouble rather
than from rsc.

One feature that would be easy to add is that if one of my aliases
is named explicitly as a destination, the from address should be
that one.  You could also have your own header that pipefrom
notices, obeys, and removes.

This should give you ideas, at least.

Russ


#!/bin/rc

rfork ne

# options
opt=()
while (! ~ $#* 0 && ~ $1 -*) {
    opt=($opt $1);
    shift
}

# change from address based on destination
fromaddr=rsc
from='Russ Cox'

# fortune=`{fortune | sed 's:\\:\\\\:g' | tr -d "}
# fortune=$"fortune
#     "All your mail looks like spam."
# from=$fortune

# I replaced the @s with %s on general principle for posting to 9fans.

# If replying, use the address the sender used.
if(~ $#replymsg 1){
    for (i in `{cat $replymsg/to | tr A-Z a-z}){
        switch($i){
        case rsc%plan9.bell-labs.com rsc%research.bell-labs.com \
            rsc%post.harvard.edu rsc%eecs.harvard.edu\
            rsc%mit.edu rsc%lcs.mit.edu rsc%pdos.lcs.mit.edu \
            rsc%amsterdam.lcs.mit.edu rsc%delbarton.org \
            rsc%sagamore6.net russ%sagamore6.net \
            9trouble%plan9.bell-labs.com \
            questions%ace.delos.com \
            question%ace.delos.com
            fromaddr=$i
        }
    }
}

# try not to use eecs in case i get axed
if(~ $fromaddr rsc%eecs.harvard.edu)
    fromaddr=rsc%post.harvard.edu

to=()
torsc=no
for(i in $*){
    if(~ $i rsc%*)
        torsc=yes
    if not
        to=($to $i)
    if(~ $fromaddr rsc)
    switch(`{echo $i | tr A-Z a-z}){
    case *harvard.edu *deshaw.com
        fromaddr=rsc%post.harvard.edu
    case *mit.edu
        fromaddr=rsc%mit.edu
    }
}

# Default.
if(~ $fromaddr rsc)
    fromaddr=rsc%swtch.com

if(~ $torsc yes)
    to=($to $fromaddr)

upasname=$fromaddr

sed '
    1,/^$/s"^From: \"Russ Cox\" <rsc>"From: \"'$from'\" <'$fromaddr'>"
' | upas/send $opt $to rsc/out%plan9.bell-labs.com
# 1i\
#    X-Plan9-Fortune: '$fortune'





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-03 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-03 16:29 [9fans] How to over ride /mail/box/bwc/headers file with Acme/Mail? Brantley Coile
2004-04-03 17:20 ` Russ Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).