Unable to populate subject field of the email while using sendmail

Hi,
Can anyone kindly provide some information about how to populate the subject field of the email while using the sendmail utility ? Itried the following command line argument :

 
echo -e "Body of the email" | /usr/lib/sendmail -f from@from.com -t to@to.com -s " Subject of the email"

While running this, although the mail reaches with the body as mentioned,but the subject field remains blank.

Any help would be highly appreciated.

Something like this worked for me:

 
/usr/lib/sendmail -t -i <<EOM
 From:test@test.com
 To:ravi.panyam@subexworld.com
 Subject:Bla

 ooo
 ooo
 oo
 EOM
1 Like

Hi panyam,
Thanks for the reply. However, could you please clarify which one is the excat option for popualting the subject line of the email ? Is it -t or -i ?

I hope neither.

man sendmail suggests that :

 

-t                    Read message for recipients.  To:, Cc:, and Bcc:
                       lines will be scanned for recipient addresses.  The
                       Bcc: line will be deleted before transmission.

-i                     Ignore dots alone on lines by themselves in incoming
                       messages. This should be set if you are reading from
                       a file.

It is a freak of luck and guesswork that your example line sent a mail. The "sendmail" command line syntax is nothing like "mailx" but "sendmail" does allow you to construct an email in any format. The post from "panyam" is very good and correctly illustrates how to send a basic email from "sendmail".