![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Email sending attachement with two file comparision | orabalu | Shell Programming and Scripting | 4 | 01-26-2009 01:12 PM |
| Sending Attachments Through mailx | vrk1219 | HP-UX | 7 | 01-21-2009 03:18 PM |
| sending mail using mailx command | manas6 | UNIX for Dummies Questions & Answers | 5 | 12-08-2008 10:20 AM |
| sending mail through mailx | pvamsikr | Shell Programming and Scripting | 3 | 07-13-2008 10:56 PM |
| sending email from mailx | legato | UNIX for Dummies Questions & Answers | 1 | 11-04-2004 10:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Sending attachement using mailx
Hi I tried reading docs from this forum and googled it...but i couldnt get the answer for attaching a document in mail. I need it to be the actual attachement not adding the content of the file to the body of the mail.. i used uuencode ...to encode the file but it is coming as a junk character in the mail body (actual mail received) Code:
uuencode /tmp/tmp-mail.txt attach.txt | /usr/lib/sendmail -t -n -f root aemunathan.r@gmail.com uuencode /tmp/tmp-mail.txt attach.txt | mailx -s "Test attachment" aemunathan.r@gmail.com in a script taken from this forum i used this way. Code:
#!/usr/bin/ksh export MAILTO="aemunathan.r@gmail.com" export SUBJECT="Mail Subject" export BODY="/tmp/tmp-mail.txt" export ATTACH="/aemu/CMW_A02_2.sql" ( echo "To: $MAILTO" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"' echo echo '---q1w2e3r4t5' echo "Content-Type: text/html" echo "Content-Disposition: inline" cat $BODY echo '---q1w2e3r4t5' echo 'Content-Type: application; name="'$(basename $ATTACH)'"' echo "Content-Transfer-Encoding: base64" echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"' uuencode --base64 $ATTACH $(basename $ATTACH) echo '---q1w2e3r4t5--' ) | /usr/lib/sendmail $MAILTO this resulted in uuencode illegal option base 64 another script i tried is Code:
#!/bin/ksh
export TOADDR=aemunathan.r@gmail.com
export FROMDIR=/aemu
cd ${FROMDIR}
( cat <<-TEXT
Hi,
Please find enclosed all of the text files found
in the directory ${FROMDIR} as of $(date).
Sincerly, $(grep root /etc/passwd| cut -d: -f5)
TEXT
for FNAME in *.sql
do
uuencode ${FNAME} ${FNAME}
done
) | mailx -s "${FROMDIR}/*.sql as of $(date)" ${TOADDR}
this resulted in junk charaters in the body of the mail Any one help me out what mistake am doing here.... Thanks Aemu |
|
||||
|
Hi
Mail sending is ok but not the attachement. am getting junk like this in the body of the mail... Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|