How do i write a mail from a script

Hi all,
How do i send a mail using mailx r mail command from a script with the following information along with it
a) the mail should be send to a person with a CC to some other person
b)with a subject
c) with a message.
this mail has to be send withing a script so u cannot pass any command line arguments. I mean to say that based on some condition the command has to be executed with the following things

Thanks in advance.
Cheers
Arunava

see his tread: http://forums.unix.com/showthread.php?threadid=25

Hi mib,
Thanks for ur help.I saw the document that u have refered.Most of the things i did'nt understood. By the way is there any way of writing a simple script by using mailx or mail command to achieve my job.
Thanks in advance
Cheers
arunava

try this:

#!/bin/bash

Recieps="one@of3 two@of3 three@of3"
mailx -s "Testing..." $Recieps < /message/text

you can also use sendmail:

#!/bin/bash

TO="someone@somewhere.com"
CClist="one@of3 two@of3 three@of3"
FROM="you@youraddress.com"

/usr/sbin/sendmail -t <<EOF

To: $TO
CC: $CClist
From: $FROM
Subject: $Subject

The message

EOF

if you have metamail in your system use metasend. this is flexible and more easiest in mail scripting.