Operating System - HP-UX
1847394 Members
3224 Online
110264 Solutions
New Discussion

Regarding mailx from HP-UX system

 
Prakalp
Occasional Contributor

Regarding mailx from HP-UX system

hi, i have 2 doubts regarding the mailx feature in hp-ux system -
(1) i am currently trying to send a test mail using a shell script like :

HEADER="Test mail"
mailx -s "$HEADER" prakalp_shrivastava@infosys.com <testing ..
EOF
exit 0

however it is not going .. is there some environment variable or setting i need to make for this ??

(2) the test mail sent from above script, in the "From" mail tag, whose mail id will be shown ? does it depend on the user who has logged in the system currently while executing the script ?
is it possible to change the id shown in "From" tab by changing a variable in some mail setting file ?


looking fwd to some opinions on this, sorry if this is in the wrong section (?) and thanks for ur time .

regards,
Prakalp
11 REPLIES 11
harry d brown jr
Honored Contributor

Re: Regarding mailx from HP-UX system

I just ran your example in a korn shell and it worked perfectly. My next test will send you an email!

#!/usr/bin/ksh
HEADER="Test mail"
mailx -s "$HEADER" prakalp_shrivastava@infosys.com <test from an itrc forums member
..
EOF

Maybe your sendmail isn't working?


(2) The login name of the user will appear. Thus if they login as root it will show root@SYSTEMNAME.infosys.com

live free or die
harry d brown jr
Live Free or Die
Prakalp
Occasional Contributor

Re: Regarding mailx from HP-UX system

thanks for looking into it harry !

(1) problem solved :-) am able to send mails now .

(2) logged in as user - root - and sent a test mail to my id, where the From tag showed new mail from - root@ccd.com

needed to know, where do i make changes in the server machine so tht the From tag in the mail shows different 'name' than the one logged in while sending ..
i'd be guessing there is some config sendmail file for this ... could any one confirm the same ?
last option would be to write a script for this .. any ideas ?

best,
prakalp.
harry d brown jr
Honored Contributor

Re: Regarding mailx from HP-UX system

take a look at procmail - http://hpux.ee.ualberta.ca/hppd/hpux/Networking/Mail/procmail-3.22/

live free or die
harry d brown jr
Live Free or Die
Prakalp
Occasional Contributor

Re: Regarding mailx from HP-UX system

hi harry,

well the machine is currently being used for some critical processes and batch runs .. though procmail seems to be able to do the job, i'd be sticking my neck out there ..

if there is any manual settings to be done, in ur knowledge, please let me know .. it wud be a GREAT help.

thanks again,
waiting,
Prakalp.
harry d brown jr
Honored Contributor

Re: Regarding mailx from HP-UX system

I think you can screw with the sendmail rules, but you need a superman cape, a power rangers ring, a Jedi sword and a doctorate in bio-engineering to develop the rules. Try a google search.

live free or die
harry d brown jr
Live Free or Die
Geoff Wild
Honored Contributor

Re: Regarding mailx from HP-UX system

You can do this with the genericstable" feature.

See:

http://www.sendmail.org/virtual-hosting.html

You will have to re-compile your sendmail.cf...

If you would like to reverse-map local users for out-bound mail, you will need to add support for the generics table to your .mc file:

FEATURE(`genericstable', `dbm /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

And you will need to create /etc/mail/genericstable which is like /etc/mail/virtusertable above except the columns are reversed:

jschmoe joe@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.
Geoff Wild
Honored Contributor

Re: Regarding mailx from HP-UX system

Ok - here's hoe to do it on HP-UX:

backup your sendmail.cf:

cd /etc/mail
cp - sendmail.cf sendmail.cf.bak

Create new sendmail.cf

/usr/contrib/sendmail/usr/newconfig/etc/mail/cf/cf/gen_cf

select generics table option

cp sendmail.cf.gen sendmail.cf

Create the genericstable(whitespace is TAB)

root you@yourdoamin.com

makemap dbm genericstable
Make any other changes to sendmail.cf that you need - like DM or DS
Restart sendmail...if needed...

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.
Dave La Mar
Honored Contributor

Re: Regarding mailx from HP-UX system

Prakalp-
On your "from" question, see attached examples of using mailx.
Looks as though all else has been sufficiently answered.

Regards,
dl
"I'm not dumb. I just have a command of thoroughly useless information."
David de Beer
Valued Contributor

Re: Regarding mailx from HP-UX system


Easy:

cat filename | mailx -s "Heading_goes_here" -r name_of_return_address@domain.name name(s)_of_recipients

Example:

cat /etc/hosts | mailx -s "Hosts file" -r me@mydomain.com me@mydomain.com otherperson@mydomain.com

would create and email that appears to come from me@mydomain.com (that's if your mailserver for the domain to which you belong, allows relaying)

David.
Geoff Wild
Honored Contributor

Re: Regarding mailx from HP-UX system

Prakalp,

Did any of the above help/solve your issue?

If yes, then please assign points and close this thread - if no, then let us know in case you need more assistance...

Thanks...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.
Prakalp
Occasional Contributor

Re: Regarding mailx from HP-UX system

thanks for replying folks!
well, think this much help should get me through .. will confirm the same asap and assign points as well.

thanks again.

best,
prakalp.