shithub: sirjofri_de

ref: 9c5cc19fe258edfcad2d502c1ecf6438147cd050
dir: /changeblog/1608301892.ms/

View raw version
.HTML Automatically save sent files in “Sent”
.TL
Automatically save sent files in “Sent”
.LP
Since it is what many mail clients do it might be helpful for other people to have this.
As for me, I like to have all my outgoing mails automatically saved in a \fISent\fR directory, so that's what I want to do.
.PP
There are multiple ways to do this.
I want to present a very simple way without sending your mail to yourself or something like that.
.PP
Outgoing mail is processed via
.CW upas/send
or
.CW /mail/box/$user/pipefrom ,
if that exists.
We use this feature to build or own little filter script for outgoing mails.
.PP
The script itself is very simple.
We just need a temporary place to store the mail message, then save it in the
.CW Sent
directory and forward it to the normal send routines:
.P1
#!/bin/rc
.br
rfork en
# see /sys/src/cmd/upas/filterkit/pipefrom.sample .
bind -c /mail/tmp /tmp
TMP=/mail/tmp/mine.$pid
.br
cat > $TMP
.br
/bin/upas/mbappend /mail/box/<yourusername>/Sent < $TMP
/bin/upas/send $* < $TMP
.P2
.PP
Of course you need to create the directory
.CW /mail/box/<yourusername>/Sent
and exchange
.CW <yourusername>
with your
.CW $user
and make this script executable.
.PP
The
.CW Sent
directory needs read and write access for your own user, which should be fine with the defaults.
.PP
If you want unauthenticated users to send mails to that directory you need to make this directory world-writable.
.PP
With these adjustments you can send mails with acme/marshal and they are automatically saved in your
.CW Sent
mailbox.