Help with mail command

Hi Friends,

While sending a mail from a shell script, is there a way i can mark some names in the To list and for some names i need then to be in the cc list.

Are there any options available for the same with the mail or mailx xommands where i can specify the names to be present in To : list or cc: list.

Thanks in advance

mail -c cc-addr to-addr

You can try with send mail utility...here is a script

SUBJ="Send mail from Unix with file attachments"
TO=urmail.com
CC=otherrec.com,onemore.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!

cat << !
HOPE THIS WORKS
you got the mail from sendmail utility
!

uuencode watch_script1.txt watch_script1.txt
!

) | sendmail -v ${TO} ${CC}

And how about MIME-headers?

yes you are right "!" must be removed after uuencode command.Thanks for correcting me.I am not sure about MIME headers may be you can elaborate on this....thanks

I've asked whether sendmail will add MIME-headers or they must be added manually??

Hi Hitori,

I tried using
mail -s "This is the subject" -c cc-abc.com to-def@gillette.com < $HOME/mail_contnts.txt

it is giving me invalid options error.

Look at man mail, try to quote email addresses