Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I specify alternate sender address(From) when sending with /bin/mailx ?

0 views
Skip to first unread message

viki

unread,
Apr 19, 2008, 5:17:10 AM4/19/08
to
How do I specify alternate sender address(From) when sending with /bin/
mailx ?

Thanks
Viki

Bill Cole

unread,
Apr 19, 2008, 12:05:44 PM4/19/08
to
In article
<d0550dfd-882a-4c36...@s50g2000hsb.googlegroups.com>,
viki <vik...@gmail.com> wrote:

Assuming that your /bin/mailx is not significantly different from the
traditional BSD version, you can't.

--
Now where did I hide that website...

Frank Slootweg

unread,
Apr 20, 2008, 6:38:30 AM4/20/08
to
viki <vik...@gmail.com> wrote:
> How do I specify alternate sender address(From) when sending with /bin/
> mailx ?

If it's a *fixed* From:, i.e. always the same, then perhaps this old
trick might work. Note: I haven't used it for years and can't test it
a the moment, so proceed at your own risk:

In .mailrc:
===========
set sendmail=/home/user/local/bin/mymail

Script /home/user/local/bin/mymail:
===================================
#! /usr/bin/sh

{
echo "From: Your Name <us...@host.domain>"
cat
} | /usr/sbin/sendmail $*

Note: In my script I still have a few commented-out debug statements.
Perhaps they come in handy if you can't get thing to work right-away:

Before the '{ ... }' construct:
===============================
# echo '$0:' $0 >>/home/franks/mymail.log
# echo '$*:' $* >>/home/franks/mymail.log
# DOLLAR_STAR="$*"
# echo '$DOLLAR_STAR:' X${DOLLAR_STAR}X >>/home/franks/mymail.log

After the '{ ... }' construct, i.e. *instead* of the current '} ...' line:
==========================================================================
# } | tee -a /home/franks/mymail.log | /usr/sbin/sendmail $*
# } | tee -a /tmp/mm$$ | /usr/sbin/sendmail $DOLLAR_STAR
# } | tee -a /tmp/mm$$ | /usr/sbin/sendmail -t

I hope this helps.

0 new messages