sending email from a ksh script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sending email from a ksh script
# 1  
Old 10-21-2009
sending email from a ksh script

hi all,
i have a ksh script which is meant to send an email with an attachment. i use the following command to send email

Code:
/usr/bin/uuencode $logFn $logFn | /usr/bin/mail -s "restoration results" $EMAILTO;

where '$logFn' is the name of the file including the full path e.g /appl/log/output.log

when i try and execute the script, the email which i receive has garbage characters in the body of the email and there are no attachments. sample email i get is :

Code:
begin 640 /appl/log/output.log
M5&AU($]C=" R,B Q,CHR,#HQ,B!.6D14(#(P,#D@(" @("!R97-T;W)I;F<@
M9&%T82!N;W<@+BXN"E1H=2!/8W0@,C(@,3(Z,C Z,C0@3EI$5" R,# Y(" @
M(" @26YV;VMI;F<@<W1O<F5D('!R;V-E9'5R92XN+@I[,C(M,3 M,C P.2 Q
M,CHQ,#HQ,B @($EN<V5R=&5D(#$V.#,@<F]W<R!I;B!#04U?0T%,3%]154E#

but when i manually type the uuencode command from the same directory as the log file and hit 'enter' it works.

any suggestions on what could be wrong ??


thanks in advance.

---------- Post updated at 07:58 PM ---------- Previous update was at 07:03 PM ----------

ok got it.

i should use 'mailx' instead of 'mail'. spotted it while reading and verifying my own post !!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending email in shell script

Can anyone help me out how to send the email without the word success while sending to the recipient. echo "success" | mailx -s "webshell instance has been started noiw" implementation@tkcl.com (8 Replies)
Discussion started by: ramkumar15
8 Replies

2. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

3. AIX

Sending script output as email

Hi i have a script which executes daily through cron. The output of the script is appended to a log file everyday It also emails me the output of the logfile as we have the mailx command in the script The below is my requirement : Normally When I get the email it sends the entire content... (3 Replies)
Discussion started by: newtoaixos
3 Replies

4. Shell Programming and Scripting

Sending email from shell script

Hi, I need to send email from a shell script. i echoed some information to a file and i am doing cat command in the email syntax thanks (2 Replies)
Discussion started by: rocky1954
2 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. Shell Programming and Scripting

Shell script for sending automatic email to personal mail id

hi guys, I need a shell script to send mail automatically to my personal mail id like xxxx@hotmail.com but while experimenting with "mail" command I faced following problems. cat text1.txt | mail -s 'test mail' xxxx@hotmail.com command successfully executed but while checking for... (4 Replies)
Discussion started by: rrd1986
4 Replies

7. Shell Programming and Scripting

Running a shell script in cron...email not sending - help??

I am pretty new to Unix shell scripting, but wondered if anyone could help (in layman's terms if possible!!) :) I have a shell script which ultimately sends an alert to an email address if part of a batch of programs fails. Here's the script that sends the email: Script: 6check.csh... (8 Replies)
Discussion started by: tjhorwood
8 Replies

8. UNIX for Dummies Questions & Answers

Email sending through a shell script

Hi everyone, I have a shell script that I use to send some emails with attachments. Based on the attachment file that is being sent, I choose the recipient. My file_list.txt looks like this CAJ.txt;sm@email.com KXLD.txt;jc@email.com I do a grep on this file to look for the file name and... (3 Replies)
Discussion started by: memonks
3 Replies

9. Shell Programming and Scripting

Sending attachments using email through shell script

Hi all, I have written a shell script which sends emails with attachments to our clients. All our attachments are simple flat files (.txt format). The script is working fine and sending the attachments to the mail-ids except that, when i am sending the attachments to non-outlook users (Like... (6 Replies)
Discussion started by: symhonian
6 Replies

10. Shell Programming and Scripting

sending email from KSH unix script.

Hi Need guidance on including code to mail a couple of files atached with some subject and mail body !!.. Thanks in advance (3 Replies)
Discussion started by: rosh0623
3 Replies
Login or Register to Ask a Question