Sponsored Content
Top Forums Shell Programming and Scripting problem with attaching multiple attachments dynamically. Post 302523427 by bhagat.singh-j on Thursday 19th of May 2011 12:30:44 AM
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..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
uuencode(n)					       Text encoding & decoding binary data					       uuencode(n)

__________________________________________________________________________________________________________________________________________________

NAME
uuencode - UU-encode/decode binary data SYNOPSIS
package require Tcl 8 package require uuencode ?1.1.4? ::uuencode::encode string ::uuencode::decode string ::uuencode::uuencode ?-name string? ?-mode octal? (-file filename | ?--? string) ::uuencode::uudecode (-file filename | ?--? string) _________________________________________________________________ DESCRIPTION
This package provides a Tcl-only implementation of the uuencode(1) and uudecode(1) commands. This encoding packs binary data into printable ASCII characters. ::uuencode::encode string returns the uuencoded data. This will encode all the data passed in even if this is longer than the uuencode maximum line length. If the number of input bytes is not a multiple of 3 then additional 0 bytes are added to pad the string. ::uuencode::decode string Decodes the given encoded data. This will return any padding characters as well and it is the callers responsibility to deal with handling the actual length of the encoded data. (see uuencode). ::uuencode::uuencode ?-name string? ?-mode octal? (-file filename | ?--? string) ::uuencode::uudecode (-file filename | ?--? string) UUDecode a file or block of data. A file may contain more than one embedded file so the result is a list where each element is a three element list of filename, mode value and data. OPTIONS
-filename name Cause the uuencode or uudecode commands to read their data from the named file rather that taking a string parameter. -name string The uuencoded data header line contains the suggested file name to be used when unpacking the data. Use this option to change this from the default of "data.dat". -mode octal The uuencoded data header line contains a suggested permissions bit pattern expressed as an octal string. To change the default of 0644 you can set this option. For instance, 0755 would be suitable for an executable. See chmod(1). EXAMPLES
% set d [uuencode::encode "Hello World!"] 2&5L;&\@5V]R;&0A % uuencode::uudecode $d Hello World! % set d [uuencode::uuencode -name hello.txt "Hello World"] begin 644 hello.txt +2&5L;&@5V]R;&0` ` end % uuencode::uudecode $d {hello.txt 644 {Hello World}} BUGS, IDEAS, FEEDBACK This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category base64 of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation. KEYWORDS
encoding, uuencode CATEGORY
Text processing COPYRIGHT
Copyright (c) 2002, Pat Thoyts base64 1.1.4 uuencode(n)
All times are GMT -4. The time now is 11:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy