How to configure mailx command??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to configure mailx command??
# 1  
Old 03-26-2007
How to configure mailx command??

Hi,

{SunOS}

I have this mailx -s command in my script and when the script is run,it throws me this message

The flags you gave are used only when sending mail.
Usage:mailx -eiIUdFntBNHvV!~ -T FILE -u USER -h hops -r address -s SUBJECT -f FILE users.

Can you help me how i can send an email at the end of the execution of the script.

Thanks,
Kumar
# 2  
Old 03-26-2007
Can you please paste the script ?
# 3  
Old 03-26-2007
Quote:
Originally Posted by sysgate
Can you please paste the script ?
#!/bin/ksh

cd tmp/sa/all_files
dt=$(date "+%b-%d-2007")
for i in *
do
mv $i ${i%.*}".${dt}"
done

cd /tmp/sa/all_files
ls ampddw.* > /tmp/sa/origlist.txt

cd /space/dwland/prodland
ls ampddw* > /tmp/sa/dailylist.txt

comm -23 /tmp/sa/origlist.txt /tmp/sa/dailylist.txt > /tmp/saravana/diff.txt
cat /tmp/sa/diff.txt | wc -l > /tmp/sa/file_check_cnt

if [ /tmp/sa/file_check_cnt > 0 ] ;then
mailx -s "Difference of files" -ss@cs.com < /tmp/sa/diff.txt
else
mailx -s "All files have arrived" -ss@ics.com < /tmp/sa/dailylist.txt
fi
# 4  
Old 03-26-2007
You cannot have "-s" in the mail, it will treat it like flag for subject.
If I execute what you have in the script from command line, I receive this :
Quote:
mailx -s "test" -ss@test.com
You must specify direct recipients with -s, -c, or -b.
# 5  
Old 03-26-2007
There is syntax error in mailx command. use like this.


mailx -s "Subject of Mail " -c " CC List if you want to CC" xyz@xyz.com < "Body of the mail from file (or) out put of some command "
# 6  
Old 03-28-2007
Quote:
Originally Posted by kumarsaravana_s
#!/bin/ksh

cd tmp/sa/all_files
dt=$(date "+%b-%d-2007")
for i in *
do
mv $i ${i%.*}".${dt}"
done

cd /tmp/sa/all_files
ls ampddw.* > /tmp/sa/origlist.txt

cd /space/dwland/prodland
ls ampddw* > /tmp/sa/dailylist.txt

comm -23 /tmp/sa/origlist.txt /tmp/sa/dailylist.txt > /tmp/saravana/diff.txt
cat /tmp/sa/diff.txt | wc -l > /tmp/sa/file_check_cnt

if [ /tmp/sa/file_check_cnt > 0 ] ;then
mailx -s "Difference of files" ss@cs.com < /tmp/sa/diff.txt
else
mailx -s "All files have arrived" ss@ics.com < /tmp/sa/dailylist.txt
fi
I have this script which is set to email me when a event occurs.I dont get any errors when i execute this script.But i dont any email neither.Is there something else i got to do...like any access privileges or path setting...

Thanks for your help,
Kumar
# 7  
Old 03-28-2007
now you've correct script. you need to check smtp for mail sending/receving from that box. you may just check mails simply by sending mail from prompt. if you recive then we can look @ script otherwise need to work in that area..
good luck & post if any errors.

Testing mail :

mailx -s "Difference of files" ss@cs.com < press enter >
Enter some text
^d
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Configure mailx in Solaris 10

Hello, We are using exchange server in our environment. I need to configure mailx to send email from Solaris box to one mail I'd which is on exchange server. I know ip of exchange server.. Let me know where should I configure that ip to do the needful? (2 Replies)
Discussion started by: sureshsun
2 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. Shell Programming and Scripting

configure from address in mailx command

Hi, I need to configure customized from address in mailx command. Can you pls tell me the option for configuring from address. Thanks Latika (9 Replies)
Discussion started by: latika
9 Replies

5. Solaris

mailx command

Dear all, Every time if i use mailx it is asking for entering the From Address. I want to set it in some place, So that it will take it by default whenever we send mails. Pl help on this. Regards JeganR (2 Replies)
Discussion started by: jegaraman
2 Replies

6. Solaris

Mailx command

HI All, I have an unix server , where sendmail command works for sending mail. But if i use mailx command it is not working. Is there any specific settings needed for this. Kindly help. Thanks and Regards Rj (1 Reply)
Discussion started by: jegaraman
1 Replies

7. 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

8. Solaris

Configure mailx or sendmail

hi, I would like to configure mailx or sendmail to send out some mails to some users. I tried searching online for the configuration but it was kinda confusing. I thought that posting here might get someone to work with me step by step I tried sending out mail but i did not receive in my... (4 Replies)
Discussion started by: cghcgh
4 Replies

9. 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

10. Shell Programming and Scripting

mailx command

Hi friends, i have seen the following line in some unix shell script . can some one explain me what exactly the statement is meant for ? ========================================================= mailx -s " Master Data Transmission Report for $TODAY at $TIME " < /etc/tr/tmp/$tmplog... (5 Replies)
Discussion started by: sveera
5 Replies
Login or Register to Ask a Question