Sponsored Content
Full Discussion: uuencode not found !
Operating Systems Linux Red Hat uuencode not found ! Post 302697863 by Corona688 on Friday 7th of September 2012 01:47:40 PM
Old 09-07-2012
Found a script here which might work with slight modification.

Code:
#!/usr/bin/perl
use strict;
use MIME::Base64;

if ($#ARGV < 2)
{
        print(STDERR "Not enough parameters\n\n");
        print(STDERR "Usage:\n");
        print(STDERR "\t./send.pl e\@mail \"Subject\" file1 file2 ...\n");
        print(STDERR "\t./send.pl \"e\@mail,a\@ddress\" \"Subject\" file1 file2 ...\n\n");
        exit -1;
}

#Sendmail requires email addresses to be separated by comma AND space
my $to = $ARGV[0];
$to =~ s/,/, /g;

# Do not use sendmail, just print to stdout -- Corona688
#open STDOUT, "|/usr/sbin/sendmail -t";

my $boundary = "_----------=_10167391557129230";

print("Content-Transfer-Encoding: 7bit\n");
print("Content-Type: multipart/mixed; boundary=\"$boundary\"\n");
print("MIME-Version: 1.0\n");
print("Date: ".`date`);
print("To: $to\n");
print("Subject: $ARGV[1]\n\n");

for (my $i = 2; $i <= $#ARGV; $i++)
{
        my $basename = `basename $ARGV[$i]`;
        $basename =~ s/\s//g;
        print("\n--".$boundary."\n");
        print("Content-Transfer-Encoding: base64\n");
        print("Content-Type: application/octet-stream; name=\"$basename\"\n\n");

        local $/=undef;
        open FILE, $ARGV[$i] or die "Couldn't open file $ARGV[$i]";
        binmode FILE;
        my $content = <FILE>;
        close FILE;

        print encode_base64($content)."\n\n";
}

print("--$boundary\n.\n");

Code:
$ chmod +x ./send.pl

$ ./send.pl myemail attachment send.pl

Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="_----------=_10167391557129230"
MIME-Version: 1.0
Date: Fri Sep  7 11:47:48 CST 2012
To: myemail
Subject: attachment


--_----------=_10167391557129230
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream; name="send.pl"

IyEvdXNyL2Jpbi9wZXJsCnVzZSBzdHJpY3Q7CnVzZSBNSU1FOjpCYXNlNjQ7CgppZiAoJCNBUkd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2c7CiAgICAgICAgcHJpbnQoIlxuLS0iLiRib3VuZGFyeS4iXG4iKTsKICAgICAgICBw
cmludCgiQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0XG4iKTsKICAgICAgICBwcmlu
dCgiQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07IG5hbWU9XCIkYmFzZW5h
bWVcIlxuXG4iKTsKCiAgICAgICAgbG9jYWwgJC89dW5kZWY7CiAgICAgICAgb3BlbiBGSUxFLCAk
QVJHVlskaV0gb3IgZGllICJDb3VsZG4ndCBvcGVuIGZpbGUgJEFSR1ZbJGldIjsKICAgICAgICBi
aW5tb2RlIEZJTEU7CiAgICAgICAgbXkgJGNvbnRlbnQgPSA8RklMRT47CiAgICAgICAgY2xvc2Ug
RklMRTsKCiAgICAgICAgcHJpbnQgZW5jb2RlX2Jhc2U2NCgkY29udGVudCkuIlxuXG4iOwp9Cgpw
cmludCgiLS0kYm91bmRhcnlcbi5cbiIpOwo=


--_----------=_10167391557129230
.

$

You need to give the subject and recipients to perl, not mailx. Then you should be able to use it like this.
./send.pl ... | mailx
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

uuencode

hi all, I dont know of this is a duplicate thread, but the thread i started a while ago wasnot posted still. ok my question is i have a shell script named "mail_editck.sh". i have to include some reports in it so that i can get the email when they are done. the syntax goes like this. ... (2 Replies)
Discussion started by: tejasingaraju17
2 Replies

2. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies

3. UNIX for Advanced & Expert Users

uuencode: command not found when sending mail in LINUX

HI all, When i run this command below i get this error: (cat /root/body.txt ; uuencode -m Summaryfile.zip) | mailx -s "completed" sandeep@help.com bash: uuencode: command not found Does anyone know why this is happening? Or is there any alternative to send mail with an... (2 Replies)
Discussion started by: bsandeep_80
2 Replies

4. Shell Programming and Scripting

uuencode/mailx

Hi all, I know how to use the uuencode/mailx commands to mail a single file within a directory, e.g. uuencode file.dat file.dat | mailx joe.smith@mail.com but now, i need to be able to mail every file within the directory with one command, any ideas? thanks :b: (1 Reply)
Discussion started by: ocelot
1 Replies

5. Shell Programming and Scripting

Uuencode

Hi All, I have a queryin the uuencode option. Actually i need to attach two files in a single mail. I am aware of attaching a single file using the command below. (echo " The first file ";uuencode file1 file1) | mailx -s " The files " venkidhadha@in.com However i am not sure what... (6 Replies)
Discussion started by: venkidhadha
6 Replies

6. UNIX for Dummies Questions & Answers

uuencode

Ello I am having trouble getting uuencode to work. This is the command I am using. gzip -c /directory/path/file.txt | uuencode /directory/path/file.txt.gz | \ /usr/bin/mailx -s"file -$(date)" email@email.com < /directory/path/file.txt.gz However when I receive the email there is... (5 Replies)
Discussion started by: demention
5 Replies

7. UNIX for Dummies Questions & Answers

uuencode without attachment

Hi All, I'm using uuencode to send out mail from unix to lotus notes,but i dont have any attachment to send out, I'm getting this message in the body of the mail "Usage: uuencode remotedest" however if i dont use uuencode I'm not able to send out mail Please help Thanks (1 Reply)
Discussion started by: gwrm
1 Replies

8. Shell Programming and Scripting

uuencode

HI, I want to zip it before sending to email. -- This works fine. uuencode gtsa_lmt_pb_rfs_daily.txt ukba_pb_rfs_daily.csv | mailx -s "ukba_pb_rfs_daily" test@abc.com --Below command is not working, it sends zunk file. uuencode gtsa_lmt_pb_rfs_daily.txt ukba_pb_rfs_daily.csv | gzip... (9 Replies)
Discussion started by: Sampath.Rachcha
9 Replies

9. Shell Programming and Scripting

Need help in uuencode command

Hi, I am trying this command. /usr/bin/uuencode test.xls error.xls | mail -s "Testing" <emailid> Instead of me having an attachment, i am getting this. begin 644 error.xls M1&%T87-T86=E($5R<F]R<PI,2U`S.B!7:&5N(&-H96-K:6YG(&]P97)A=&]R... (7 Replies)
Discussion started by: mac4rfree
7 Replies

10. Linux

Uuencode not found

Hi guys when i try to get the man page of uuencode i am getting it,But when i use in shell script to send attachment i am getting uuencode not found error .please help me guys.Thank U (3 Replies)
Discussion started by: mohanalakshmi
3 Replies
All times are GMT -4. The time now is 04:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy