Operating System - HP-UX
1825985 Members
3133 Online
109690 Solutions
New Discussion

Re: mailx.rc set parm for reply-to?

 
Jim Turner
HPE Pro

mailx.rc set parm for reply-to?

This is probably an easy fix -- maybe I took stupid pills this morning. Is there a parameter that can be set in /usr/share/lib/mailx.rc that is equivalent to using the "-r unix_sysadm@hertz.com" command-line option?

I'm trying to rewire mailx such that any use of it will always rewrite the reply-to as "unix_sysadm@hertz.com" regardless of what account actually invokes mailx for sending via cmd line.
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: mailx.rc set parm for reply-to?

how about alias

make mailx alias to mailx -r unix_sysadm@hertz.com

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: mailx.rc set parm for reply-to?

add:

set from unix_sysadm@hertz.com

in the .mailrc file or in the system wide:

/usr/share/lib/mailx.rc

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Jim Turner
HPE Pro

Re: mailx.rc set parm for reply-to?

Thanks, Geoff, but no joy -- at least not as root.

Steven, yours might be my solution if I can find an easy way to ensure the alias is set when I need it. The scripts that that need the modified mailx are fired from root's crontab. I've tried it interactively, and it works fine. I'm reserving points assignment for your suggestion until I see if it's the one I use.

Thanks to you both!
Steven E. Protter
Exalted Contributor

Re: mailx.rc set parm for reply-to?

i understand.

What I might do is set up a file in /etc/rc.config.d

With the alias commands and any other environment you want in your cron scripts.

Call it /etc/rc.config.d/cronenv

All cron scripts will need to be modified to have this line in them:

. /etc/rc.config.d/cronenv

I'm trying this out, not for command alias, but so that I can have central control of my cron environment.

Obviously, I don't now how to modify the configuration file you mentioned.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: mailx.rc set parm for reply-to?

Strange it doesn't work for mailx - but it does for elm.

vi ~/elm/elmheaders

Add:

From: unix_sysadm@hertz.com


Then use elm to send email:

elm -s "test" you@yourdomain.com
Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Jim Turner
HPE Pro

Re: mailx.rc set parm for reply-to?

Thank you everyone for your suggestions. They are all viable solutions. Since we had more than the root user cron-ing mailx commands and needing different rewritten reply-to addresses, we just beat everyone with a stick and told them to code-in the unique "-r someone@somewhere" that they needed. The brighter ones will do it via an env variable. It should be interesting to watch.
Procnus
Frequent Advisor

Re: mailx.rc set parm for reply-to?

I've run into this sort of thing before, what I've done is add to the top of the email message going out the following line:
~R
@

With the appropriate address and host. If your cat'ing through to mailx you could have your line looking like:
echo "~R @" | cat - | mailx ...

Or similar.

Cheers
Steven
Jim Turner
HPE Pro

Re: mailx.rc set parm for reply-to?

Thanks again for all the wonderful ideas.