I'm running a script to send a mail with few lines. Requirement is I need to add few people in cc.

So I have created below scripts. For people who needs to be in TO and CC , I have created 2 separate files as you can see below :

echo Reminder mail sending date!!!

CC_LIST=cat cc_list.maillist

TO_LIST=cat to_list.maillist

echo "$CC_LIST"

echo "$TO_LIST"

cat test_mail.txt | mailx -r [email protected] -s "subject" "$TO_LIST" -c "$CC_LIST"

So without -c "$CC_LIST", my script running fine but while using -c option it gives error as below :

-c... User unknown

As it seems considering -c as another mailed.

Please help

1 Answer 1


The mailx utility assumes that the operands at the end of the command line are all addresses to send the email to.

Just make sure that all options are specified before any of the recipients' addresses. In other words, swap -c "$CC_LIST" with "$TO_LIST".

  • I have checked several options like just passing mail ids without list or placing cc before to....every time the error is same as it didn't recognize command -c....treating it as new mail id -c !!!
    – Shubh
    Commented Apr 4, 2018 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .