Syntax for mailx command

Hello,
I am trying to write a unix shell script program to send mail to cc and to list.I am using the '-c' option for mailx unix command,but am getting an error illegal -c option.
Could any one please guide me to use the mailx command in unix shell scripting to send the mail to the Cc and To list along with the attachment ?

Thanks in advance
Appreciate the response

Questions by shalinik.sdm

Showing Answers 1 - 6 of 6 Answers

You should be able to use something like the following example to get the CC option working with mailx. Preferably create a list of users needed to be put in the CC option (as mailCClist.txt in the example). Hope this helps.

Code
  1. SUBJECT="Email Subject Line"

  2. TO=xyz@company.com

  3. CC=`tr '

  4. ' ', ' < mailCClist.txt`

  5. #BCC="xyz2@comp.com"

  6.  

  7. echo "Send the E-mail message..."

  8. /usr/bin/mailx -s "${SUBJECT}" ${TO} <<-END

  9.  

  10. ~< ! uuencode $DCdir/$FileName "Result.txt"

  11.  

  12. ~c ${CC}

  13. ~b ${BCC}

  14.         Hi,

  15.  

  16.         Blah, Blah.. body of the email.

  17.  

  18.         Thanks

  19.         Satya

  20.         ~.

  21.         END

  22.  

  23. echo "Mail Sent!!"


  Was this answer useful?  Yes

Mitra

  • Nov 24th, 2011
 

Code
  1. uuencode attachment1 attachment1 | mailx -c x@yz.com,a@bc.com -s "subject" m@no.com

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions