Overriding Mailx Command


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Overriding Mailx Command
# 1  
Old 12-06-2012
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
# 2  
Old 12-06-2012
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Help with Mailx command

I need to do below in mailx : 1. to list 2. CC list (I am using tilde command for this) 3. -r option 4. attach .csv file Below is the command i am using : ( echo '~c abc@xyz.com'; cat mailtext.txt; uuencode attach.csv attach.csv) | mailx -s "${SUBJECT}" -r "abc@xyz.com" -m ${MAIL_LIST}... (4 Replies)
Discussion started by: ManOfSteel
4 Replies

2. Red Hat

Mailx command

Using RHEL 5.5 New to using 'mailx' Was trying to check if mailx is configured. mailx command gives a list of unread mails. Now I tried to send mail using this command to a local or on network machine using mailx -s "Test2" "root@<servername>" But did not receive any message. (6 Replies)
Discussion started by: ikn3
6 Replies

3. Shell Programming and Scripting

mailx command

( cat textfile.txt; ) | mailx -s "test mail " `cat mailids.lst` from :'server@example.com' to : for all contacts in text file mailids.lst above command is sending mails correctly for all contacts in text file mailids.lst, but 'from' address is showing as 'server@example.com' but i want... (5 Replies)
Discussion started by: only4satish
5 Replies

4. UNIX for Dummies Questions & Answers

mailx command

Hi, I am seeing that this command is sending mail even when the nawk command in untrue ( does not have any output ). I only want it to send mail, where it goes above the threshold, and has some output. nawk -F'(MOD dn="uid=)|(DEL dn="uid=)|' '/(MOD dn="uid=)|(DEL dn="uid=)/... (2 Replies)
Discussion started by: john_prince
2 Replies

5. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

6. Programming

C++ overriding Vs hiding

class B { public: void fns(void){//base def;} }; class D:public B { public: void fns(void) {//new def;} }; I was thinking the above is overriding but somewhere else i found the above is just hiding.Only virtual functions can be considered as overriding? This is the exact statement ... (1 Reply)
Discussion started by: johnbach
1 Replies

7. Shell Programming and Scripting

Mailx command

Hi, This post is regarding sending mails from Unix. How can we include "bcc" in a "mailx" command. I searched google to find out the -b option; but my man pages doesnot show that option(it throws me an error: "-b not found"). It has a "~b" option but i am not sure how to use it. Could you people... (2 Replies)
Discussion started by: Thumban
2 Replies

8. UNIX for Dummies Questions & Answers

mailx and -s command

How does the -s command work with mailx. I know that -s is to create a symbolic link when being used with ln but i'm not sure what the command does with mailx. Anyone?:confused: (1 Reply)
Discussion started by: kjetterman
1 Replies

9. Shell Programming and Scripting

mailx command help

Dear All, I need to send a mail to a group ( the address of which is in a .profile file)..My basic mailing functionality isn't working. When i try to run mailx -s "Hello" abc@xyz.com the command does not return to the prompt an runs infinitely. Request you to help me out here along with... (3 Replies)
Discussion started by: kaushikraman
3 Replies

10. Shell Programming and Scripting

Overriding PATH

Hello, I'm using Sun solaris . I'm trying to override the environmental variable in my script, however when I execute the script, the PATH whatever being set in .profile is taking precedence. I have done the sanity checks like order of my entry in path, permissions for the user etc., To... (1 Reply)
Discussion started by: brainyoung
1 Replies
Login or Register to Ask a Question