Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-19-2011
Registered User
 

Join Date: Aug 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
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 12:56 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Solaris 10, problem with attaching driver solaris_user Solaris 3 04-02-2010 05:16 AM
Problem in attaching CVS file to the mail alokjyotibal Shell Programming and Scripting 0 12-01-2009 05:08 AM
Problem with multiple excel attachments using mailx ramanam2004 UNIX for Advanced & Expert Users 2 05-04-2006 01:07 AM
multiple attachments edog FAQ Submission Queue 5 01-06-2003 01:09 PM
multiple attachments edog How do I send email? 5 01-06-2003 01:09 PM



All times are GMT -4. The time now is 04:20 AM.