9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: mirtchov@cpsc.ucalgary.ca
To: 9fans@cse.psu.edu
Subject: Re: [9fans] archive outgoing mail
Date: Mon, 26 Jan 2004 12:17:39 -0700	[thread overview]
Message-ID: <6f208cfa2c6fb1aa9f90207ea5e94437@plan9.ucalgary.ca> (raw)
In-Reply-To: <62bb0841a646c26e0e730e30a4288ff2@mteege.de>

the following archives outgoing mail daily, easy to modify for monthly
archival:

% cat /mail/box/andrey/pipefrom
#!/bin/rc

rfork e
ramfs

TMP=/tmp/pipefrom.$pid
datum=`{mdate}
fileto=/mail/box/$user/sent/$datum

test -e $fileto || {touch $fileto; chmod +a $fileto}

cat > $TMP

cat $TMP >> $fileto
echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' >> $fileto

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

# collect addresses and add them to my patterns
dests=()
while (! ~ $#* 0) {
	dests=($dests $1);
	shift
}

# send mail
upas/send $options $dests < $TMP
%

you need to mkdir /mail/box/$user/sent for this to work...

mdate is a very simple program that prints the date in a format that's
easily sortable:

% cat $home/src/cmd/mdate.c
#include <u.h>
#include <libc.h>


void
main(int argc, char *argv[])
{
	Tm *t;

	USED(argc, argv);

	t = localtime(time(0));

	print("%4.4d-%2.2d-%2.2d", t->year+1900, t->mon+1, t->mday);

	exits(0);
}
%

one problem with this scheme -- the you can't use upas/fs on the
sorted emails (they have different format than the one in your inbox).
I haven't bothered to fix it, though a bit of sed-ing would suffice.



      reply	other threads:[~2004-01-26 19:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26 18:56 Matthias Teege
2004-01-26 19:17 ` mirtchov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f208cfa2c6fb1aa9f90207ea5e94437@plan9.ucalgary.ca \
    --to=mirtchov@cpsc.ucalgary.ca \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).