sendmail subject configuration
Hai all,
I've configured sendmail in my Linux machine and it is working fine and am sending mail like : echo "Test" | sendmail -v oracle@ora.com.su the mail is delivered successfully with the content Test.. how can I add subject to this mail.. such that the mail should get deliver with the subject. Please guide Yusuf |
'echo "Subject: Test" | /usr/sbin/sendmail -t user@host' should work, however using "mail" from the mailx or mail-utils package will be easier ('/bin/true| mail -s "Test" user@host'). If you're going to send attachments from the CLI or a shellscript later on search for "mpack".
|
unspawn
Quote:
Hai , Thanks for the guidance.. above works fine.. but how to add message body ..I want to have both subject and body message for the same. 'echo "Subject: Test" | /usr/sbin/sendmail -t user@host' it works fine.. where I can add the message of the mail. please guide Yusuf |
'(echo "Subject: Test"; echo; cat /etc/hosts) | /usr/sbin/sendmail -t user@host'
|
Quote:
Thanks unspawn for your answer, I did the following as u said : oracrp@oracle test]$ cat alert.sh #!/bin/sh # Script used to monitor the database alert log file RETURN_CODE=`grep ORA-* /d02/oracle/oracrp/proddb/9.2.0/admin/DEV_oracle/bdump/alert_DEV.log | wc -l` if [ $RETURN_CODE -eq 0 ] then exit 0 else '(echo "Subject:Test"; echo "DEV - There are $RETURN_CODE errors in Alert log)' | /usr/sbin/sendmail erp_webmail@ali.com.kw exit 1 fi am getting the error : alert.sh: line 8: (echo "Subject:Test"; echo "DEV - There are $RETURN_CODE errors in Alert log): command not found Guide please Yusuf |
Code:
(echo "Subject:Test"; echo "DEV - There are $RETURN_CODE errors in Alert log") Code:
/usr/sbin/sendmail user@host << EOM |
Quote:
such that it should display the subject test with time (echo "Subject:Test"; echo "DEV - There are $RETURN_CODE errors in Alert log"). am executing the script with sh in the line it sends mail to the user where as when I add it to the cron .. it does'nt work .. any idea colucix ?..How I can fix it ? user is added to cron.allow and no users are in cron.deny cornd is runniing.. Thanks for your patience and guidance Yusuf |
Quote:
Code:
Subject: $(date +%d-%b-%Y) - any other text here Regarding your other issue about the cron job, I'm following the other thread of yours and... it's puzzling me! Bye. |
Quote:
Yusuf |
All times are GMT -5. The time now is 09:09 AM. |