0

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 abc@xyz.com -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

0

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

1
  • 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
    Apr 4 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.