Overriding Mailx Command

Hello All,

I am working on a project where the requirement is override mailx command in such way that, instead of sending mailing to email addresses coded in codes, it should send mails to one common email address at run time.
We do not intend to change the email addresses in codes.

This problem was temporarily resolved by setting up aliases in .mailrc file. But I need to take care of any future new email addresses for which everytime I have to define new alias.

I thought of overriding mailx command to a function with name as mailx() in .profile which does this for me. But in that function I will not be able to read the attachment file as in below example:-

cat $filename |uuencode abcd.xls | mailx -s "Subject" $eml_adrs

I want this command to send the mail to my email address at place of $eml_adrs with AS IS body text and attachment. at RUNTIME.

Is there any way?

Thanks in advance. Looking Forward.

Regards
Shubham

aliases are a standard way to do this.

Most places put email addresses in one separate text file per app/script. The script that sends email reads the file and sends mail to the address(es) listed. Consider putting in a request to the developers to follow that paradigm.

mailx is a front end for sendmail. This shows how to block email from being sent to a list of email addresses, among other things. Which it seems is what you actually want.

cf/README - Anti-Spam Configuration Control