problem with attaching multiple attachments dynamically.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem with attaching multiple attachments dynamically.
# 1  
Old 05-19-2011
problem with attaching multiple attachments dynamically.

Guys,
I've been trying to attach & email all txt files from my directory using the shell script below:

Code:
#!/usr/bin/sh
################################################################################
send_ml_rej_notn()
{
FILE_NAME=${1}
ATTACH_FILE_NAME=`basename ${FILE_NAME}`

if [ -s ${MAIL_TXT} ]; then 

    ( cat ${CUST_MAIL_HDR}  ${MAIL_TXT} ${CUST_MAIL_FOOTER}; \
     ${FILE_NAME_AP} ${ATTACH_FILE_NAME} ) | mailx -r \
    "$MAIL_SENDER" -m -s "${CONST_CUST_MAIL_SUB}" "${CONST_SUPPORT_MAIL_REPT}"
fi
}

ls *txt >${FILE_LIST}
cat ${FILE_LIST}| while read FILE_NAME
do
if [ -s ${FILE_NAME} ] ; then
FILE_NAME_AP="${FILE_NAME_AP} uuencode ${FILE_NAME} ${FILE_NAME} &&"
done
send_ml_rej_notn  ${FILE_NAME_AP}


--
The script does the emaling, however the attachments are missing.
The body of the mail contains the message below:
Code:
Usage: uuencode [ -m ] [ source ] remotedest


Could someone offer guidance please?.

All that I'm trying is to attach & email all txt files from my directory.

Thank you!!

-Bhagat

Last edited by pludi; 05-19-2011 at 01:56 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to send mail with multiple attachments?

We don't have uuencode installed in our machines..... Please tell me how to send mail with multiple attachments ??? URGENT !!!!! Please tell me using command line (or) scripts.......... please...... Thanks in Advance.... (1 Reply)
Discussion started by: vamshigvk475
1 Replies

2. Shell Programming and Scripting

Multiple attachments using mutt

I am trying to attach multiple files using mutt command, and all file names to be attached are taken from a flat file. and mutt command is called from a bash script when : 1. Script execution is completed. 2. Script execution is interrupted for some reason. ... (8 Replies)
Discussion started by: Shaishav Shah
8 Replies

3. Emergency UNIX and Linux Support

Problem in attaching zone

Hi, I have installed few Veritas packages in my local zone. Prior to that, I had detached non-global zones. After successfull installation of veritas packages on global zone, I am attaching non-global zones with -u option, but stuck with one NGZ. One of the NGZ is having gsk7bas 7.0.4.38 while... (5 Replies)
Discussion started by: solaris_1977
5 Replies

4. Shell Programming and Scripting

Problem with multiple mail attachments

Hi everyone... I am facing problem with the multiple mail attachments. cd /work/mohan/pi_log/ mail_file='uuencode ahmedabad.csv ahmedabad.csv ; uuencode ahmedabad_devrpt_20110530.csv ahmedabad_devrpt_20110530.csv' ( $mail_file ) | mailx -m -s"test" domain@website.com its giving me error... (1 Reply)
Discussion started by: mohanm
1 Replies

5. Solaris

Solaris 10, problem with attaching driver

Today I installed Solaris driver for my NIC card (downloaded from OpenSolaris site ) I`m using Solaris 10 x86 based PC ! When I installation was completed I saw a message "Warning driver successfully added to system bad failed to atach " , then i looked at /etc/drivers_aliases and saw... (3 Replies)
Discussion started by: solaris_user
3 Replies

6. Shell Programming and Scripting

Problem in attaching CVS file to the mail

i wrote this code(( cat $REPORT_EMAIL;uuencode <$OUTFILE $OUTFILE ) | mailx -s "Auto Policy Attach Report Before batch job " $SUPPORT_EMAIL_GRP) in my shell script to attach afile but in the mail i donot get a attachment contais of the mail is Auto Policy Attach Report Before batch job... (0 Replies)
Discussion started by: alokjyotibal
0 Replies

7. Shell Programming and Scripting

Sending multiple attachments

Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using: send_mail() { uuencode $TMP $TMP1 > $TMP1... (1 Reply)
Discussion started by: deo2k8
1 Replies

8. UNIX for Advanced & Expert Users

Problem with multiple excel attachments using mailx

I have written the following code send multiple attachments using mailx (uuencode file1 file1; uuencode file2 file2; uuencode file3 file3;) | mailx -s MultipleAttachments -r Sysadmin abc@xyz.com The attachments are coming properly if the file1,2,3 are either pdf, text, doc. But if these files... (2 Replies)
Discussion started by: ramanam2004
2 Replies

9. Answers to Frequently Asked Questions

multiple attachments

how can you send multiple attachments in 1 email, usually I just use uuencode to send 1 attachment. thanks (5 Replies)
Discussion started by: edog
5 Replies

10. How do I send email?

multiple attachments

how can you send multiple attachments in 1 email, usually I just use uuencode to send 1 attachment. thanks (5 Replies)
Discussion started by: edog
5 Replies
Login or Register to Ask a Question