9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] Acme Mail editable from address
@ 2021-01-28 22:51 Romano
  0 siblings, 0 replies; 15+ messages in thread
From: Romano @ 2021-01-28 22:51 UTC (permalink / raw)
  To: 9fans

> 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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [9fans] Acme Mail editable from address
@ 2021-01-27 23:30 pouya+lists.9fans
  2021-01-28  0:34 ` ori
  2021-01-28 10:00 ` Richard Miller
  0 siblings, 2 replies; 15+ messages in thread
From: pouya+lists.9fans @ 2021-01-27 23:30 UTC (permalink / raw)
  To: 9fans

I was looking for a way to send emails from different addresses with
Acme Mail, as I use + address suffixes to sort incoming mail and
occasionally need to send emails from the same (e.g.  to this mailing
list).  Not finding a convenient way, I committed a bad hack to
include an optional From: line in the header of outgoing messages.
It's available at

9p.io/sources/contrib/pdt/acme/mail

in case someone might find it useful (or be kind enough to tell me
this is not the right way to do it).

Pouya



------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T9469a3ec554967c5-M059a7a0d5e206cd7b9c25ef2
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

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

end of thread, other threads:[~2021-02-02 12:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 22:51 [9fans] Acme Mail editable from address Romano
  -- 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

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