![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send email with attachement-Getting connection refused by domain | samuelc | UNIX for Dummies Questions & Answers | 1 | 02-08-2008 12:25 PM |
| I am not able to send mail form unix to other mail accounts. | chinnigd | UNIX for Dummies Questions & Answers | 1 | 04-06-2006 09:31 AM |
| can not send mail from unix server to company/yahoo mail | b5fnpct | UNIX for Dummies Questions & Answers | 5 | 11-22-2002 09:24 PM |
| Send a mail with an attachement of a file | gaddeg | UNIX for Dummies Questions & Answers | 2 | 07-23-2002 03:01 PM |
| Send a mail with a subject and an attachement | josecollantes | UNIX for Dummies Questions & Answers | 1 | 08-28-2001 12:55 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to send Mail with Attachement
Hi
Can somebody help me in wirting shell script in the following way.Desperately i have poseted this.. 1.How can I connect to Oracle(Sqlplus) from UNIX. 2.After connecting to it I have to execute an oracle proceudure.. 3.Execution of the procedure will give some set of rows.. 4.The set of rows have to be 'Spool' to a seperate file and that file has to be sent to particular user as attachement. Regards Gopinath |
|
||||
|
echo "Hi\n\n This is mail body \n\n Thanks & regards \n Myself." > /tmp/$$.mailbody
sqlplus -s $CONNECT_STRING <<EOF > /tmp/$$.attachment your pl/sql block here to call the stored procedure exit; EOF uuencode $$.attachment results.txt >> /tmp/$$.mailbody mailx -s "SUB: Stored procedure results" yourname@email.com < /tmp/$$.mailbody rm /tmp/$$.mailbody rm /tmp/$$.attachment do some checks with the results file to check that the stored procedure completed successfully or failed... otherwise you will get a email with the sql error in case if it failed. Last edited by mahendramahendr; 02-03-2006 at 05:56 AM.. |
|
||||
|
Here is what I do. I simplified the code and remove the variables so you can understand better. Code:
echo "To: user@mail.com" > mail.tmp echo "From: your@mail.com" >> mail.tmp echo "Subject: your subject" >> mail.tmp echo "Your text" >> mail.tmp uuencode path/attached_file attached_file >> mail.tmp cat mail.tmp | /usr/sbin/sendmail -t |
|
||||
|
$$ is nothing but a process id
The funda behind using $$ infront of file name is, if two people executing the same script, it won't overwrite others and end... I'm just starting the file name with the process id... assuming the file will be unique if I include the process id in the file name... |
![]() |
| Bookmarks |
| Tags |
| mailx, mailx attachment, sendmail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|