uuencode not working for multiple files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting uuencode not working for multiple files
# 1  
Old 05-21-2009
uuencode not working for multiple files

Hi,

I have gone through the other related post but are of no help for me

I am sending multiple files as attachement.
The first file comes fine as an attachement but the other files are coming as binary.

For people with older version of email software they can see all attachements but the people with new version can see only the first attachement.
I have tried the following code but still the same problem.

Code:
mailx -s "test" ABC@XYZ.com << EOF
`/usr/bin/uuencode IJK.csv IJKM.csv`
`/usr/bin/uuencode IOU.csv IOLUA.csv`
EOF


Code:
(uuencode   IJK.csv IJKM.csv; uuencode -m IOU.csv IOLUA.csv) | mailx -s "test" ABC@XYZ.com


I want to fix the problem from unix side.

Appreciate help
# 2  
Old 06-02-2009
UNIX mail utilities long predated the attachment schemes improvised in the mid 90's. You'll need to use a specialized utility, a custom perl-script, or a full-fledged mail program (such as pine). Here's a perl script to help; but it will require some modules (MIME::Lite and dependencies) to be installed. It only does one attachment at a time, but you can modify it, right?
Code:
#!/usr/bin/perl -w
use MIME::Lite;
use Getopt::Std;
our ($opt_d,$opt_s,$opt_f, $opt_h);
getopt('ds:f:h:');

# Specify the mailhub with -h (or localhost used)
# Specify recipients on the command line
# Specify the file to be attached with -f (only one)
# Subject with -s

### Create a new multipart message:
my $msg = MIME::Lite->new(
   From    => $ENV{USER} . '@' . `hostname -f`,
   Subject => $opt_s,
   Type    => 'multipart/mixed'
);

### Add parts (each "attach" has same arguments as "new"):
my (@text) = <STDIN>;
(scalar(@text)) and $msg->attach(
   Type     => 'TEXT',
   Data     => \@text
);

$opt_f and $msg->attach(
   Type     => 'application/zip',
   Path     => $opt_f,
   Filename => $opt_f,
   Disposition => 'attachment'
);

### use Net:SMTP to do the sending
for (@ARGV) {
  $msg->replace('To',$_);
  $msg->send('smtp',($opt_h || "localhost"), Debug=> ($opt_d ? 1 : 0) );
}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending multiple files using uuencode command

Hi All, I want to send multiple CSV file using below code. In Result folder, we have multiple CSV files. However, I want to catch only Summary CSV files. I was trying using *, % with different combination. However, not able to do so. From below code, I could send only one file... (1 Reply)
Discussion started by: Swapnil Mawle
1 Replies

2. Shell Programming and Scripting

Uuencode for mail attachments not working

Hi, I'm trying to send mail with attachments using uuencode, but it doesn't work. Command (also tried with mailx): uuencode testfile testfile | mail emailadress The email I get doesn't have an attachment, and has this in the message body: begin 664 testfile %=&5S=`H` ` end ... (4 Replies)
Discussion started by: Subbeh
4 Replies

3. UNIX for Dummies Questions & Answers

Editing multiple files with vi, why :p is not working

Hi, Can any gurus advise why :p is not working on my vi? When editing multiple files, :n works and it takes me the next file, but :p which is supposed to take me back to the previous file does not work. Please advise. Thanks in advance. (2 Replies)
Discussion started by: newbie_01
2 Replies

4. Shell Programming and Scripting

Problem while working with multiple files

Dear friends, I am working with two files named g1.txt and g2.txt....g1.txt is my main file in which it contains following data #per_no permissionname permission command 1|HideCDrive, | : REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v... (1 Reply)
Discussion started by: jalpasoni
1 Replies

5. Shell Programming and Scripting

sending multiple files along with mail message using uuencode

Hi, I have a requirement to send a mail with multiple files attached to it and along with the text message in the mail. I am trying sumthing like below but it only sends me the text message and no files attached to the mail. ---------------------------------------- ( uuencode file1... (1 Reply)
Discussion started by: sachinkl
1 Replies

6. Shell Programming and Scripting

uuencode is not working properly

Hello Everyone, I'm very new to the shell script. I'm trying to send multiple attachments in unix using uuencode command. Total I have 3 text files which should be send in mail. but I'm getting 6 files and 3 files with subject as file name. And the content is ` end I'm working... (6 Replies)
Discussion started by: narikivar
6 Replies

7. Shell Programming and Scripting

Send files as an attachment without uuencode

Hi All, Is there anyway we can send files as an attachment? I tried running uuencode but its giving an error as below: $ uuencode Z1.txt Z1.txt |mailx -s "hi" abc@abc.com ksh: uuencode: not found. Null message body; hope that's ok When i gave which command then it says there is no... (18 Replies)
Discussion started by: HemaV
18 Replies

8. Shell Programming and Scripting

Not able to send multiple attachments using uuencode and mailx

Hi, I am seeing some junk characters when I attach the second file, given below is the logic I used. Please help me resolving the issue. ( uuencode file1.txt file1.txt.lst && uuencode file2.txt file2.txt.lst ) > attachment.txt cat body.txt attachment.txt > combinemail.txt mailx -m... (7 Replies)
Discussion started by: prasperl
7 Replies

9. Shell Programming and Scripting

uuencode mailx - send multiple emails

The following is an extract from one of my Shell Scripts which uses uuencode and mailx to send an email with multiple attachements: uuencode $LOG_REPORT $(basename $LOG_REPORT) uuencode $HTML_FILE $(basename $HTML_FILE ) ) | if then mailx -b "$COPY_TO" -s "$SUBJECT" -r "$MAIL_FROM"... (2 Replies)
Discussion started by: suthera
2 Replies

10. Linux

uuencode not working

"uuencode" is not working for me kindly help me i am using Linux 2.4.9-e.72 enterprise #1 SMP Thanks, Anil (1 Reply)
Discussion started by: 150177
1 Replies
Login or Register to Ask a Question