Search This Blog

Tuesday, January 26, 2010

linux command sendmail with subject

If you send mail using sendmail command, there is no option for subject.
For example:
sendmail -F "system admin" -t "youself@gmail.com" < security.log Here is the trick how to using sendmail command to send mail with subject 1, create your log file which you want to email to yourself add following line in the front of log file ===================== #!/bin/sh echo "From: system admin" > security.log
echo "To: youself@gmail.com" >> security.log
echo "Subject: security log" >> security.log

2, using this command to send mail

sendmail -oi -t < security.log

No comments:

Post a Comment