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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 10:00 ` Richard Miller
                     ` (2 preceding siblings ...)
  2021-01-30 15:01   ` pdt
@ 2021-01-30 15:06   ` pdt
  3 siblings, 0 replies; 15+ messages in thread
From: pdt @ 2021-01-30 15:06 UTC (permalink / raw)
  To: 9fans

[9fans@hamnavoe.com]
> if (~ $dests *9fans@9fans.net*) {
>         sed '1,/^$/s/^(From: .*)<miller@hamnavoe.com>/\1<9fans@hamnavoe.com>/' | upas/send $options $dests
>         exit
> }

Testing this.  Please ignore!


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 10:00 ` Richard Miller
  2021-01-28 19:07   ` pouya+lists.9fans
  2021-01-29 14:36   ` sirjofri
@ 2021-01-30 15:01   ` pdt
  2021-01-30 15:06   ` pdt
  3 siblings, 0 replies; 15+ messages in thread
From: pdt @ 2021-01-30 15:01 UTC (permalink / raw)
  To: 9fans

[9fans@hamnavoe.com]
> if (~ $dests *9fans@9fans.net*) {
>         sed '1,/^$/s/^(From: .*)<miller@hamnavoe.com>/\1<9fans@hamnavoe.com>/' | upas/send $options $dests
>         exit
> }

Testing this.  Please ignore!


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 10:00 ` Richard Miller
  2021-01-28 19:07   ` pouya+lists.9fans
@ 2021-01-29 14:36   ` sirjofri
  2021-01-30 15:01   ` pdt
  2021-01-30 15:06   ` pdt
  3 siblings, 0 replies; 15+ messages in thread
From: sirjofri @ 2021-01-29 14:36 UTC (permalink / raw)
  To: 9fans

I adjusted my pipefrom and added a default headers file, so lets see
if this mail arrives with the correct sender address.

sirjofri


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 23:21     ` ori
@ 2021-01-29 10:17       ` Richard Miller
  0 siblings, 0 replies; 15+ messages in thread
From: Richard Miller @ 2021-01-29 10:17 UTC (permalink / raw)
  To: 9fans

> Yes -- acme Mail does set its own From lines,

That's overridden by the From: in /mail/box/$user/headers if there is one.


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

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

* Re: [9fans] Acme Mail editable from address
  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
  1 sibling, 1 reply; 15+ messages in thread
From: ori @ 2021-01-28 23:21 UTC (permalink / raw)
  To: 9fans

Quoth pouya+lists.9fans@nohup.io:
> I should take a closer look but I seem to recall some special handling
> of From: lines in acme Mail.

Yes -- acme Mail does set its own From lines,
among other things that annoyed me.

(That's why I rewrote it as Nail: less cleverness,
less code, and thread sorting of messages:
http://shithub.us/git/ori/Nail/HEAD/info.html)


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 19:07   ` pouya+lists.9fans
@ 2021-01-28 22:26     ` ori
  2021-01-28 23:21     ` ori
  1 sibling, 0 replies; 15+ messages in thread
From: ori @ 2021-01-28 22:26 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.


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

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

* Re: [9fans] Acme Mail editable from address
  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 14:36   ` sirjofri
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: pouya+lists.9fans @ 2021-01-28 19:07 UTC (permalink / raw)
  To: 9fans

Thank you all for your feedback.

I have combined my answers to a few responses below.

> [pouya+lists.9fans@nohup.io]
>> I was looking for a way to send emails from different addresses with
>> Acme Mail

[9fans@hamnavoe.com]
> That's what /mail/box/$user/pipefrom is for. (Not specific to acme.)
> 

Thank you.  This seems much more elegant than my hack as a general
solution.

[ori@eigenstate.org]
> The ability is useful, but the code to do it would be better
> placed in upas/marshal.

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?

[sirjofri+ml-9fans@sirjofri.de]
> Please double-check this. When I add a From: in acme Mail it's always 
> converted to a destination address.

I should take a closer look but I seem to recall some special handling
of From: lines in acme Mail.


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 11:06       ` sirjofri
@ 2021-01-28 11:50         ` alex
  0 siblings, 0 replies; 15+ messages in thread
From: alex @ 2021-01-28 11:50 UTC (permalink / raw)
  To: 9fans

> Please double-check this. When I add a From: in acme Mail it's always 
> converted to a destination address.

Perhaps that's a quirk of acme Mail?  Works for me with Nail and
marshal(1).


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28 10:09     ` Alex Musolino
@ 2021-01-28 11:06       ` sirjofri
  2021-01-28 11:50         ` alex
  0 siblings, 1 reply; 15+ messages in thread
From: sirjofri @ 2021-01-28 11:06 UTC (permalink / raw)
  To: 9fans


28.01.2021 11:09:20 Alex Musolino <alex@musolino.id.au>:

>> I'd love this functionality in marshal. Would it then also work in 
Nail?
>> (No crazy filtering in Nail?)
>>
>> Would a potential marshal patch be applied to 9front? I think it's a 
nice
>> feature and prevents setting $upasname before starting [MN]ail. Also I
>> don't think it would change existing behavior too much.
>
> Seems it's already in 9front.  I can just write my own custom From:
> header with Nail or marshal(1).  I've never had much reason to change
> it so I just put the From: header you see in this message in
> /mail/box/alex/headers.

Please double-check this. When I add a From: in acme Mail it's always 
converted to a destination address.

sirjofri

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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28  8:34   ` sirjofri
@ 2021-01-28 10:09     ` Alex Musolino
  2021-01-28 11:06       ` sirjofri
  0 siblings, 1 reply; 15+ messages in thread
From: Alex Musolino @ 2021-01-28 10:09 UTC (permalink / raw)
  To: 9fans

> I'd love this functionality in marshal. Would it then also work in Nail? 
> (No crazy filtering in Nail?)
> 
> Would a potential marshal patch be applied to 9front? I think it's a nice 
> feature and prevents setting $upasname before starting [MN]ail. Also I 
> don't think it would change existing behavior too much.

Seems it's already in 9front.  I can just write my own custom From:
header with Nail or marshal(1).  I've never had much reason to change
it so I just put the From: header you see in this message in
/mail/box/alex/headers.


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

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

* Re: [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
  2021-01-28 19:07   ` pouya+lists.9fans
                     ` (3 more replies)
  1 sibling, 4 replies; 15+ messages in thread
From: Richard Miller @ 2021-01-28 10:00 UTC (permalink / raw)
  To: 9fans

> I was looking for a way to send emails from different addresses with
> Acme Mail

That's what /mail/box/$user/pipefrom is for. (Not specific to acme.)

For example, my pipefrom includes this:

if (~ $dests *9fans@9fans.net*) {
        sed '1,/^$/s/^(From: .*)<miller@hamnavoe.com>/\1<9fans@hamnavoe.com>/' | upas/send $options $dests
        exit
}

If I want to do a one-off send from an alias, I edit /mail/box/$user/headers temporarily
to add a From: line.


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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-28  0:34 ` ori
@ 2021-01-28  8:34   ` sirjofri
  2021-01-28 10:09     ` Alex Musolino
  0 siblings, 1 reply; 15+ messages in thread
From: sirjofri @ 2021-01-28  8:34 UTC (permalink / raw)
  To: 9fans

Hey ori,

I'd love this functionality in marshal. Would it then also work in Nail? 
(No crazy filtering in Nail?)

Would a potential marshal patch be applied to 9front? I think it's a nice 
feature and prevents setting $upasname before starting [MN]ail. Also I 
don't think it would change existing behavior too much.

sirjofri

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

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

* Re: [9fans] Acme Mail editable from address
  2021-01-27 23:30 pouya+lists.9fans
@ 2021-01-28  0:34 ` ori
  2021-01-28  8:34   ` sirjofri
  2021-01-28 10:00 ` Richard Miller
  1 sibling, 1 reply; 15+ messages in thread
From: ori @ 2021-01-28  0:34 UTC (permalink / raw)
  To: 9fans

Quoth pouya+lists.9fans@nohup.io:
> 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).
> 

The ability is useful, but the code to do it would be better
placed in upas/marshal.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T9469a3ec554967c5-M45b4767d3b572a1f2d04a7b9
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

9fans - fans of the OS Plan 9 from Bell Labs

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9fans

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9fans 9fans/ http://inbox.vuxu.org/9fans \
		9fans@9fans.net
	public-inbox-index 9fans

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9fans


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git