linux send mail with attachment

Hi All,
This blog depicts
- configure files regarding send mail service
- collect an output from sql
- send that output to recipients through mail (office domain)

configuration of send mail service file:
install the rpm of send mail
up the service "service sendmail restart"
vi /etc/mail/submit.cf
D{MTAHost}[192.168.x.x] --this will be the smtp ip then save and quit
service sendmail restart

collect an output from sql
This is very simple that you all can generate. Also this link is very useful to do that
http://www.oracle-base.com/articles/misc/OracleShellScripting.php

send that output to recipients through mail (office domain)
Okay now is the most important part. To attach that file and send it

echo | mutt -a list_"$CURR_TIME".txt -s FileName_"$CURR_TIME" x@y.com,z@y.com < mail_body.txt

Here the attachment file name is list_"$CURR_TIME".txt

This is a technique to zip a directory in linux without using tar. I have used as I have to send this zip file into windows system and I am not sure tar file can be opened by windows or not.

zip -9 Folder_Name.zip Folder_Name/*.csv

All done.

Comments

Popular posts from this blog

Restoring Master, Model and MSDB from Netbackup

Oracle Job Operations