Monday, April 16, 2012

Send mail using Shell Script

Include the below line in the script which you are writing ,so that the file ,which in this case called as OUT_FILE will be sent to the email given .

cat $OUT_FILE | mail -s "DB_Pre_check" ashraf.mohammed@oracle.com

To check the status of email service

service sendmail status
sendmail (pid 1661) is running...

The /etc/mail/sendmail.mc File You can define most of sendmail's configuration parameters in the /etc/mail/sendmail.mc file, which is then used by the m4 macros to create the /etc/mail/sendmail.cf file. Configuration of the sendmail.mc file is much simpler than configuration of sendmail.cf, but it is still often viewed as an intimidating task with its series of structured directive statements that get the job done. Fortunately, in most cases you won't have to edit this file very often.

How to Put Comments in sendmal.mc In most Linux configuration files a # symbol is used at the beginning of a line convert it into a comment line or to deactivate any commands that may reside on that line.

The sendmail.mc file doesn't use this character for commenting, but instead uses the string "dnl". Here are some valid examples of comments used with the sendmail.mc configuration file:

These statements are disabled by dnl commenting.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

This statement is incorrectly disabled:
# DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
This statement is active:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
Note: Remember to run the activate-sendmail.sh script to activate any configuration changes.

No comments:

Post a Comment