Operating System - HP-UX
1834307 Members
2591 Online
110066 Solutions
New Discussion

Changing the from when sending a mail

 
SOLVED
Go to solution
Jonathan Caplette_1
Super Advisor

Changing the from when sending a mail

Hi guys,

I'm using mailx to send mail via a script that I'v made... Is it possible to change the "from" for an email address that we specify, cause I don't want that the people who are receiving my mails reply to my "root@hostname.domain.com". See what I mean?? I know we can do it in perl, but I use shell scripts, can we??

Regards
Jonathan
4 REPLIES 4
Paul Sperry
Honored Contributor

Re: Changing the from when sending a mail


Kill sendmail
Add the alias in the /etc/mail/aliases.local file
root : whoever@domain.com
vi the /etc/mail/sendmail.cf file
Change
# location of alias file
O AliasFile=/etc/mail/aliases
To
# location of alias file
O AliasFile=/etc/mail/aliases,/etc/mail/aliases.local

Run
sendmail ???bi
sendmail ???bd
newaliases
harry d brown jr
Honored Contributor
Solution

Re: Changing the from when sending a mail

mailx -s "tst msg" -r processname@server.com receivername@someserver.com

live free or die
harry
Live Free or Die
Jonathan Caplette_1
Super Advisor

Re: Changing the from when sending a mail

Hi Paul,

I see what you mean, but is not really what I want... Maybe I forgot to mention that they could be different "from" at each mail that I send....

Any other idea?
Jonathan Caplette_1
Super Advisor

Re: Changing the from when sending a mail

Thanks Harry!!!

-r option works fine!!