Problem with -c option in Mailx command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with -c option in Mailx command
# 1  
Old 05-18-2011
Problem with -c option in Mailx command

Hi,

I am using mailx command in shell script. When i put -c option for CC , i get error message as "Unknown flag: -c" . I checked manual of mailx command and found that ~c to be used but after using ~c also it is not working. My shell is Korn. Kindly let me know what i have to do .

Thanks
# 2  
Old 05-18-2011
can you post the script, it is working fine for me.
# 3  
Old 05-18-2011
Here is part of script where i am using mailx command
Code:
while read name ccname
do
  tr -d ' ' < report.txt > mod_report.txt
  uuencode mod_report.txt Monthly_report.txt > attachment.txt
  cat message.txt attachment.txt > combined.txt
  mailx -s "Monthly report" -c $ccname  $name < combined.txt
done < maillist.txt


maillist.txt contains mailid's

Last edited by Franklin52; 05-19-2011 at 03:27 AM.. Reason: Please use code tags
# 4  
Old 05-18-2011
Code:
while read name ccname
> do
> mailx -s "test" -c $ccname $name <testing.txt
> done <mailid.txt

It worked fine for me at ksh prompt.

What is the error you are facing while you execute this script. Can you check for any empty lines in your maillist.txt file especially at the end.
# 5  
Old 05-18-2011
i get error " Unknow flag : -c". Even when i execute at command prompt or through shell script it gives same error. I checked maillist.txt file no empty line.

user.m17878: mailx -s "test" -c abc@xyz.com
Unknown flag: -c
# 6  
Old 05-18-2011
Code:
 # mailx -s "test" -c abc@xyz.com
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

I get this error when my command is incomplete. Try to send mail manually from the prompt.
# 7  
Old 05-18-2011
I tried sending mail from prompt then also it gives same error. "unknown flag -c".

I checked mail manaul and found ~c for CC but even then also i am facing problem.

mailx -s "test" ~c xyz@xyz.com then also it goes in To list for xyz@xyz.com and ~c@xyz.com
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with -s option in IF

Hello Guys , I am trying to run below in one of my script but unable to get it succeed . Can anyone help me on this? I am using HP-UX. if then write_log " Both files are present . Mail will be send to respective teams." EMAIL_SUBJECT="MGCA - File Extraction Process COMPLETED"... (12 Replies)
Discussion started by: himanshu sood
12 Replies

2. Shell Programming and Scripting

Problem in Using fgrep Command with pattern file option

Hi, i am using fgrep command with following syntax fgrep -v -f pattern_file_name file file contains few line and have the pattern which i am giving in pattern file. My Problem is : its is not giving any output. while i am using fgrep -f pattern_file_name file it is showing all... (4 Replies)
Discussion started by: emresearch
4 Replies

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

4. UNIX for Dummies Questions & Answers

problem with mailx command

Hi, I have written down a script and in that im using mailx command in Unix. Such that i have taken the reciepent that would be in "To" using read command i.e from standard input and echoed the reciepients in cc into a file .Now im not able to use the mailx -r ie which sends the sender... (1 Reply)
Discussion started by: navjotmannan
1 Replies

5. Shell Programming and Scripting

Problem with Mailx command to send mail with attachment

Hi, I am using mailx command to send a mail with attachment. It's working fine, but with attachment I am getting one extra attachment like (ATT00131.txt). I have tried to use unix2dos command also. But still I am getting the extra attachment. I am using the following code: subject="temp... (5 Replies)
Discussion started by: viswanatharv
5 Replies

6. UNIX for Advanced & Expert Users

Problem with Carbon copy (CC) option in mailx command

Hi, I have problems with the cc option in mailx command. Just went through some of the similar threads but none provides a satisfactory explanation. I have a script using the mailx command in the following way: (echo `cat mailsub.txt` ; uuencode attachment.csv attachment.csv) | mailx -s... (2 Replies)
Discussion started by: SmithaN
2 Replies

7. Solaris

mailx -c option

I get the below error message when I try to CC recipients in the mailx command. Can someone help. --------------------------------------------------------------- Can't create transcript file ./xfm0SD2kY24649: Permission denied Cannot create ./dfm0SD2kY24649: Permission denied queueup:... (0 Replies)
Discussion started by: pt14
0 Replies

8. UNIX for Dummies Questions & Answers

Postfix Problem under mailx/sendmail command

Update: Problem solved with this command: /opt/soc/bin/postfix-setup ================================ Hi, I am trying the following mailx command: sadm@edwardwi-z:/etc$ mailx ewijaya@gmail.com Subject: test foo . . EOT But it gives the following error ... (0 Replies)
Discussion started by: monkfan
0 Replies

9. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

10. UNIX for Dummies Questions & Answers

mailx problem

Here is a question I have, maybe someone can help me out. I am new to this UNIX thing. :) I have a file called elist. In this file is a list of 25 email adresses. How can I write a simple command line for that will read the names of the file and send it to each of the email addys. Can I... (2 Replies)
Discussion started by: iastorms
2 Replies
Login or Register to Ask a Question