LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sending attachmeng using uuencode (https://www.linuxquestions.org/questions/linux-newbie-8/sending-attachmeng-using-uuencode-936082/)

kais1 03-23-2012 02:52 PM

Sending attachmeng using uuencode
 
Hai all,

RHEL AS 4

am using the below code to send attachment

[code]
cat mail_body;uuencode MED_HEALTHCHECKUP.OUT MED_HEALTHCHECKUP.OUT )|mailx -s "INVALID OBJECTS REPORT FOR $DATE_SUFFIX" knehealthcheck@gmail.com &
[code]

and it is failing with the below error
[code]
uuencode: command not found
[code]

I tried installing sharutils rpm as below
[code]
warning: sharutils-4.6.1-2.ia64.rpm: V3 DSA signature: NOKEY, key ID 1d1e034b
error: Failed dependencies:
rtld(GNU_HASH) is needed by sharutils-4.6.1-2.ia64
[code]

How I can fix this ?. if not, is there any other alternative other than uuencode as I also don't have mutt installed

Please advise

Kai

Tinkster 03-23-2012 04:03 PM

Have you considered saving yourself the trouble, and using mutt?

Code:

mutt -a MED_HEALTHCHECKUP.OUT -s "INVALID OBJECTS REPORT FOR $DATE_SUFFIX" knehealthcheck@gmail.com < mail_body
mutt should be available from the install DVD/CD.


Cheers,
Tink

anomie 03-23-2012 04:07 PM

Use mutt(1). It gets you MIME-compliance. Uuencoding attachments has arguably been superseded at this stage of the game.

P.S. RHEL4 support ended a couple weeks ago.

kais1 03-24-2012 05:14 AM

sendmail with attachment s
 
Dear all,

RHEL AS 4

am using the below code to send email as attachement

[code]
ALERTDIR=/reports/final
ALRMSG_SAM=$ALERTDIR/HEALTHCHECKUP.out
if [ -f $ALRMSG_SAM ]
then
rm $ALRMSG_SAM
fi

if test -s $ALRMSG_SAM
then
/usr/sbin/sendmail -t <<EOF
From: ERP-Production Server
To: testit@gmail.com
Subject: Health Check Report
Content-Type: html
content-disposition: attachment; filename=HEALTHCHECKUP.out
EOF
fi
[code]

This doesn't work and doesn't write in /var/log/mail too. but when am using the send mail in command line like

[code]
df -h | sendmail "testit@gmail.com'
[code]

works fine ?

Any idea ?

Kai

lithos 03-24-2012 05:43 AM

Quote:

Originally Posted by kais1 (Post 4635012)
Dear all,

RHEL AS 4

am using the below code to send email as attachement

[code]
ALERTDIR=/reports/final
ALRMSG_SAM=$ALERTDIR/HEALTHCHECKUP.out
if [ -f $ALRMSG_SAM ]
then
rm $ALRMSG_SAM
fi

if test -s $ALRMSG_SAM
then
/usr/sbin/sendmail -t <<EOF
From: ERP-Production Server
To: testit@gmail.com
Subject: Health Check Report
Content-Type: html
content-disposition: attachment; filename=HEALTHCHECKUP.out
EOF
fi
[code]

This doesn't work and doesn't write in /var/log/mail too. but when am using the send mail in command line like

[code]
df -h | sendmail "testit@gmail.com'
[code]

works fine ?

Any idea ?

Kai

Hi

probably you are using BASH, so the first thing in script should define which environment uses, like:
Code:

#!/bin/bash
echo "Hello, world."

then the IF clauses when testing variables could be more correct to use double quotes " around the var name, like:
Code:

if test -s "$ALRMSG_SAM"
then you can first try to break the code into smaller pieces to see what happens with this line:
Code:

if test -s $ALRMSG_SAM

I would try it this way:

TESTOUT=$(test -s "$ALRMSG_SAM")
if [ "$TESTOUT" ]; then
...

then you will see which part is having trouble so you can correct it. (probably you have read some of this or this)

good luck

Tinkster 03-24-2012 04:31 PM

Merged the two closely related threads. Please keep your discussions in one spot.


All times are GMT -5. The time now is 08:00 PM.