Operating System - HP-UX
1821639 Members
2973 Online
109633 Solutions
New Discussion юеВ

Change the senders name and address when using mailx

 
SOLVED
Go to solution
Andrew Pollard
Super Advisor

Change the senders name and address when using mailx

Right now when I send mail to email it shows the sender as root@systemname.city.company. I would like it to say root@company.com. I tried modifying /etc/mail/sendmail.cf and sendmail.cw but when I make the change, the mail is sent to dead.letter. Any suggestions?
7 REPLIES 7
RAC_1
Honored Contributor

Re: Change the senders name and address when using mailx

From the command line you can do it as follows.

mailx -x root@company.com -s "whatever" email_address.

email_address will see it as sent by root@company.com.

Another way is to set DM macro in sendmail.cf. Check DM macro in sendmail.cf file

Anil
There is no substitute to HARDWORK
Geoff Wild
Honored Contributor

Re: Change the senders name and address when using mailx

Best is to set the DM macro in sendmail.cf:

# Masquerade as (DM): #
# #
# If you wish to have mail appear to be from some host or location #
# other than the loacl host, set macro M to the name you wish to #
# masquerade as.



# who I masquerade as (null for no masquerading) (see also $=M)
DMcompany.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.
RAC_1
Honored Contributor
Solution

Re: Change the senders name and address when using mailx

The command is
mailx -r root@company.com -s "whatever" email_address.

AND NOT

mailx -x root@company.com -s "whatever" email_address.

Anil
There is no substitute to HARDWORK
Matti_Kurkela
Honored Contributor

Re: Change the senders name and address when using mailx

Read the logs in /var/adm/syslog to see sendmail's error message.

Remember that your emails may sometimes produce MAILER-DAEMON error replies: ensure that a mailbox for root@company.com exists before doing your modifications. That will keep postmaster@company.com happier.
MK
Andrew Pollard
Super Advisor

Re: Change the senders name and address when using mailx

Thanks for all the suggestions. The command line solution using -r will work best for what I need.

Andrew
Sridhar Bhaskarla
Honored Contributor

Re: Change the senders name and address when using mailx

Hi,

Just to clarify the problem you have, though you might have enabled "DM" macro to masquerade your domain in sendmail.cf file, users specified under "CE" macro will be excluded from it. So, you will need to take out "root" from CE macro if you intend to send the mail as root@yourdomain.com instead of root@yoursystem.yourdomain.com. But taking out root isn't a good idea if you are receiving mails through EMS or other customized notifications from the systems.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Andrew Pollard
Super Advisor

Re: Change the senders name and address when using mailx

Hi Sri,

I actually didn't make any changes to the sendmail.cf file. I just used the command line suggestion and incorporated it into the scripts that needed it. It seems to have fixed my issue.

Thanks for your suggestion though, I will document it for future reference.

Andrew