> Quoth pouya+lists.9f...@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=mya...@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+bi...@example.com  myacco...@smtp1.example.com
mya...@example.com      myotheracco...@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 via email to