9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Set reply-to in pipefrom
@ 2004-01-30  9:39 Matthias Teege
  2004-01-30 13:08 ` David Presotto
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Teege @ 2004-01-30  9:39 UTC (permalink / raw)
  To: 9fans

Moin,

I have another question about pipefrom. I want to set/add
the Reply-To Header based on the To field in the email.
Is this also a task for pipefrom or is there a better
place?

Matthias


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

* Re: [9fans] Set reply-to in pipefrom
  2004-01-30  9:39 [9fans] Set reply-to in pipefrom Matthias Teege
@ 2004-01-30 13:08 ` David Presotto
  0 siblings, 0 replies; 2+ messages in thread
From: David Presotto @ 2004-01-30 13:08 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

That's the real reason I did pipefrom.  The following is probably more
complicated than you need.  I just have lots of roles.

#!/bin/rc
TMP=/tmp/pipefrom.$pid

# collect upas/send options
options=()
while (! ~ $#* 0 && ~ $1 -*) {
	options=($options $1);
	shift
}

# collect destination addresses and add them to my patterns
dests=()
while (! ~ $#* 0) {
	dests=($dests $1);
	shift
}
echo $dests > $TMP
/bin/upas/list add /mail/box/$user/_pattern $TMP >[2] /dev/null
rm $TMP

# default return address is outside one
myaddr=presotto@closedmind.org

# use destination address in message we're replying to
# if its none of mine
if(test $replymsg){
	x=`{cat $replymsg/to $replymsg/cc $replymsg/bcc}
	switch($x){
	case *gridmaster@plan9.bell-labs.com*
		myaddr=gridmaster@plan9.bell-labs.com
	case *postmaster@plan9.bell-labs.com*
		myaddr=postmaster@plan9.bell-labs.com
	case *webmaster@plan9.bell-labs.com*
		myaddr=webmaster@plan9.bell-labs.com
	case *presotto@plan9.bell-labs.com*
		myaddr=presotto@plan9.bell-labs.com
	case *presotto@closemind.org*
		myaddr=presotto@closedmind.org
	case *p.150th@closemind.org*
		myaddr=p.150th@closedmind.org
	}
}

# if we're sending to lucent, override with a lucent address
for(i in `{cat /env/dests}){
	switch($i){
	case *lucent.com* *bell-labs.com* *nslocum*
		# explicitly in house
		myaddr=presotto@plan9.bell-labs.com
	case *!* *@*
		;
	case *
		# implicitly in house
		myaddr=presotto@plan9.bell-labs.com
	}
}

# change From: and send message
sed 's/^From: presotto$/From: David Presotto <'$myaddr'>/' | tee $mail/sent |/bin/upas/send $options $dests

[-- Attachment #2: Type: message/rfc822, Size: 2296 bytes --]

From: Matthias Teege <matthias@mteege.de>
To: 9fans@cse.psu.edu
Subject: [9fans] Set reply-to in pipefrom
Date: Fri, 30 Jan 2004 09:39:32 0000
Message-ID: <211a519bb9639f5e5329dfb0ad4359ef@mteege.de>

Moin,

I have another question about pipefrom. I want to set/add
the Reply-To Header based on the To field in the email.
Is this also a task for pipefrom or is there a better
place?

Matthias

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

end of thread, other threads:[~2004-01-30 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30  9:39 [9fans] Set reply-to in pipefrom Matthias Teege
2004-01-30 13:08 ` David Presotto

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).