Problem : Use mail,mailx or sendmail?

Problem : Use mail,mailx or sendmail?

I am new to sendmail and mail. Only recently I got chance to
touch them.  I want to automate the process of sending some regular system-related emails via an UNIX box ,  so that I can notify someone by sending him an email when something related to our application systems happened .
When I use mail, there is no place to specify subject and the recipient is under “BC” (not direct receiver or “CC” ). When I use mailx and issue the following command the receiver got additional warning message inside the message body.

#mailx -s “This is my subject”  address
The receiver will get the message as below,
####################################################
The following message part was sent with the unknown
character set: X-ROMAN8
####################################################
Original Message starts here

How to get rid of these warning meesage from the message body?
As for sendmail, it can be used only after I pre-formatted
my message file, which is rather troublesome.
In addition, how can I send attachment together with an email?

Anyone knows how to solve this problem?


Solution: Use mail,mailx or sendmail?

If you can put the “Subject:”, “To:”, “Bcc” or whatever
headers at the top of the message file you are going to
send then Sendmail is probably your best choice.

Example:

The message file could look like this (without the > at
the front of every line)

>From: Automatic Notification
>Bcc: [email protected], [email protected]
>     [email protected]
>Subject: Important automatic message
>
>Some where important thing happened.

Then in your automatic (cron) program you can invoke
Sendmail like this:

sendmail -t

The -t option for Sendmail states that the recipients are
in the header of the message.

Or if you can’t put the headers at the front of the
message file you can always have the headers ready in
another file (or create one on the fly) and to it
like this:

cat headers messagefile | sendmail -t