9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Romano <unobe@cpan.org>
To: 9fans@9fans.net
Subject: Re: [9fans] Acme Mail editable from address
Date: Thu, 28 Jan 2021 14:51:22 -0800	[thread overview]
Message-ID: <DC8A19666C1BC517F07E26C9233A2F18@smtp.pobox.com> (raw)

> Quoth pouya+lists.9fans@nohup.io:
>> Upas/marshal already supports that by setting the upasname env
>> variable, or did you mean to have it as a flag or taken from the
>> headers in the input?
> 
> I was thinking that
> 
>         echo From: foo; message | upas/marshal
> 
> should be roughly equivalent to:
> 
>         upasname=foo
>         echo message | upas/marshal
> 
> but it may be better to just use a pipefrom.

Take what I say with a big a grain of salt--I set it up months ago and
haven't considered it again after Ori's re-work in 9front on
mail-related things.  I am not using my own smtp server, but call out
to different ones based on the address I'm using.

For my setup, I had to set both the env var and add the 'From:' line,
IIRC.  I have wrapper scripts that I can click on to send an e-mail
while in Acme, specifying which account I want to send from.  It's
probably more convoluted than it needs to be, but I just wanted to get
mail working on 9front.  So in my wrapper script I setup upasname env
var and also start off the message with a 'From:' line:
upasname=myacct@example.com
echo From: Myname '<'^$upasname^'>' >/tmp/from.$upasname
mailfrom $upasname $*

The last call to mailfrom calls /bin/mailfrom, which contains this:
#!/bin/rc
upasname=$1
shift
if (~ $winid '')
        err=`{echo -n Cannot find window id}
if (! test -d /mnt/acme/^$winid)
        err=`{echo -n usage: Must be run in Acme}
if (~ $upasname '')
                err=`{echo -n usage: Must set upasname}
if (! ~ $err '') {
        echo $err
        status=$err
        exit
}
if (! test -f /tmp/from.$upasname)
        echo From: $upasname >/tmp/from.$upasname
cat /tmp/from.$upasname /mnt/acme/$winid/body | upas/marshal -8 $*
rm /tmp/from.$upasname

/mail/lib/fromfiles contains one line, which refers to
/mail/lib/from.me:
from.me

/mail/lib/from.me has lines with tab-separated values between the
e-mail from address I use ($upasname) and the mail account
corresponding to it:
myacct+bingo@example.com  myaccount@smtp1.example.com
myacct@example.com      myotheraccount@smtp2.example.com

In /mail/lib/remotemail, I have cases for the different smtp servers:
#!/bin/rc
shift
sender=$1
shift
addr=$1
shift
fd=`{/bin/upas/aliasmail -f $sender}
switch($fd){
case smtp1.example.com
        addr=(-u user1 tcp!^$fd^!ssmtp)
case smtp2.example.com
        addr=(-u user2 tcp!^$fd^!ssmtp)
case *.*
        ;
case *
        fd=your.domain
}
exec /bin/upas/smtp -a -t -h $fd $addr $sender $*

Hopefully what I wrote above is more helpful than not.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T98f57a87714768fb-M0906a3667a2e63e9683b92ea
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

             reply	other threads:[~2021-01-28 22:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 22:51 Romano [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-27 23:30 pouya+lists.9fans
2021-01-28  0:34 ` ori
2021-01-28  8:34   ` sirjofri
2021-01-28 10:09     ` Alex Musolino
2021-01-28 11:06       ` sirjofri
2021-01-28 11:50         ` alex
2021-01-28 10:00 ` Richard Miller
2021-01-28 19:07   ` pouya+lists.9fans
2021-01-28 22:26     ` ori
2021-01-28 23:21     ` ori
2021-01-29 10:17       ` Richard Miller
2021-01-29 14:36   ` sirjofri
2021-01-30 15:01   ` pdt
2021-01-30 15:06   ` pdt

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=DC8A19666C1BC517F07E26C9233A2F18@smtp.pobox.com \
    --to=unobe@cpan.org \
    --cc=9fans@9fans.net \
    /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).