shithub: sirjofri_de

ref: f685133b8e7c756b7b42a242da87400a658d9afb
dir: /changeblog/1608301892.ht/

View raw version
<article>
<header>
<h2>Automatically save sent files in “Sent”</h2>
<b>Fri, 18 Dec 2020 15:31:32 +0100</b>
</header>
<p style="margin-top: 0; margin-bottom: 0.50in"></p>
<p style="margin-top: 0; margin-bottom: 0.21in"></p>

<p style="line-height: 1.4em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: center;">
<span style="font-size: 12pt"><b>Automatically save sent files in “Sent”</b></span></p>
<p style="margin-top: 0; margin-bottom: 0.21in"></p>

<p style="margin-top: 0; margin-bottom: 0.21in"></p>

<p style="margin-top: 0; margin-bottom: 0.42in"></p>
<p style="margin-top: 0; margin-bottom: 0.21in"></p>
<p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="margin-top: 0; margin-bottom: 0.50in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">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 </span><span style="font-size: 10pt"><i>Sent</i></span><span style="font-size: 10pt"> directory, so that&rsquo;s what I want to do.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">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.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">Outgoing mail is processed via
</span><span style="font-size: 10pt"><tt>upas/send</tt></span><span style="font-size: 10pt">
or
</span><span style="font-size: 10pt"><tt>/mail/box/$user/pipefrom</tt></span><span style="font-size: 10pt">,
if that exists.
We use this feature to build or own little filter script for outgoing mails.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">The script itself is very simple.
We just need a temporary place to store the mail message, then save it in the
</span><span style="font-size: 10pt"><tt>Sent</tt></span><span style="font-size: 10pt">
directory and forward it to the normal send routines:
</span></p><p style="margin-top: 0; margin-bottom: 0.08in"></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>#!/bin/rc</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>rfork en</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt># see /sys/src/cmd/upas/filterkit/pipefrom.sample .</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>bind -c /mail/tmp /tmp</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>TMP=/mail/tmp/mine.$pid</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>cat &gt; $TMP</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>/bin/upas/mbappend /mail/box/&lt;yourusername&gt;/Sent &lt; $TMP</tt></span></p>
<p style="line-height: 1.1em; margin-left: 1.28in; text-indent: 0.00in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 9pt"><tt>/bin/upas/send $* &lt; $TMP</tt></span></p>
<p style="margin-top: 0; margin-bottom: 0.17in"></p>

<p style="margin-top: 0; margin-bottom: 0.08in"></p>
<p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">Of course you need to create the directory
</span><span style="font-size: 10pt"><tt>/mail/box/&lt;yourusername&gt;/Sent</tt></span><span style="font-size: 10pt">
and exchange
</span><span style="font-size: 10pt"><tt>&lt;yourusername&gt;</tt></span><span style="font-size: 10pt">
with your
</span><span style="font-size: 10pt"><tt>$user</tt></span><span style="font-size: 10pt">
and make this script executable.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">The
</span><span style="font-size: 10pt"><tt>Sent</tt></span><span style="font-size: 10pt">
directory needs read and write access for your own user, which should be fine with the defaults.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">If you want unauthenticated users to send mails to that directory you need to make this directory world-writable.
</span></p><p style="margin-top: 0; margin-bottom: 0.05in"></p>
<p style="line-height: 1.2em; margin-left: 1.00in; text-indent: 0.35in; margin-right: 1.00in; margin-top: 0; margin-bottom: 0; text-align: justify;">
<span style="font-size: 10pt">With these adjustments you can send mails with acme/marshal and they are automatically saved in your
</span><span style="font-size: 10pt"><tt>Sent</tt></span><span style="font-size: 10pt">
mailbox.
</span></p><p style="margin-top: 0; margin-bottom: 0.50in"></p>

</article>