General
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I mask "From" while using mailx

 
SOLVED
Go to solution
Kent Ostby
Honored Contributor

How do I mask "From" while using mailx

Hi folks --

I send a lot of email from the command line from one particular account using something like:

mailx -s "Subject" you@yourcompany.com < inputfile

I'd like to change it so that account ALWAYS uses a different "from" address (Its a ServiceGuard package and I want the return email to come to name of the package not the name of the machine its running on).

If there isn't a way to change this for the whole user account then I'd like to know how to mask it using mailx (since thats what I use).

Thanks,

Oz
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
13 REPLIES 13
Marcel Boogert_1
Trusted Contributor

Re: How do I mask "From" while using mailx

Hi there,

mailx -s "Subject" -r me@mycompany.com you@yourcompany.com < inputfile

This should solve your problem.

MB.
Geoff Wild
Honored Contributor

Re: How do I mask "From" while using mailx

You could do this globaly, by setting the DM macro in /etc/mail/sendmail.cf

DMyourdomain.com

Which will then have a from address of user@yourdomain.com instead of user@machine.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.
RAC_1
Honored Contributor

Re: How do I mask "From" while using mailx

Check -r option for mailx.
Also check DM macro in sendmail.cf.

Anil
There is no substitute to HARDWORK
Geoff Wild
Honored Contributor

Re: How do I mask "From" while using mailx

Just checked the man page - use -r

mailx -s "test" -r me@somewhere.com gwild
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.
Simon Hargrave
Honored Contributor

Re: How do I mask "From" while using mailx

You can use the -r option to pass the address.

If you want to be more complicated you can spoof: -

telnet mailserver 25
helo mydomain.com
mail from:brokenthing@serviceguard.com
rcpt to:admin@mydomain.com
data
Subject: It broke

It's all gone wrong
.
quit
Simon Hargrave
Honored Contributor

Re: How do I mask "From" while using mailx

...as a midway option you can also append fields into the envelope. It's not foolproof though as the original will still be there, but the mail client should pick up the latest.

eg:-

cat <From: "Bill"
To: "Undisclosed Recipients"

I like my software, so there!
EOF
Kent Ostby
Honored Contributor

Re: How do I mask "From" while using mailx

Is there a way to change it at the user level instead of the domain level in sendmail ?
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Rick Garland
Honored Contributor

Re: How do I mask "From" while using mailx

Are you using the same FROM address for all mails that originate from these SG systems?

How about setting the masquerade function.
Jeff Gyurko
Frequent Advisor

Re: How do I mask "From" while using mailx

I like the -F option of sendmail for this so I can actually put anything I want as the from like /usr/sbin/sendmail -bm -F "anything you want here" you@yourcompany.com