Specify Subject Line With Sendmail

How to specify Subject line with the sendmail command?
How can Subject line be specified?
How to specify the From mail ID?
How to specify the Subject?

You need to provide the headers. sendmail will add some headers if you fail to provide them (such as Message-Id, Date...) but it expects that you provide the headers. sendmail is to send raw emails. You should consider using the mailx command instead.

Or:

sendmail -oi -t << EOF
From: Prasad Joseph 
To: Prasad 
Subject: the subject

Body of the message
EOF

The headers are separated from the body by an empty line.

"-t" tells sendmail to look for the addresses to send this to in the To: and Cc: (and possibly Bcc: in which case it will remove it before sending the email) headers of the message.

Or:

For mailing text, I would use

mail -s "subject here" prasad_joseph@domain.com < filename_here

Or:

mailx -s "subject here" prasad_joseph@domain.com < filename_here

Or:

Send mail isn't intended at a user interface. You can type, line-for-line something like:

send mail myemail@mycompany.com
Subject: my repot
This is the body of my message
^D

Note the line that begins with "Subject:" triggers the subject line. The ^D is a control_D which signifies end-of-file. 

Have a Unix Problem
Unix Forum - Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.