How to send windows attachment using senmail

Brad De Vries devriesbj
Mon May 17 11:47:51 PDT 2004


--- Swapana Ghosh <swapana_ghosh at yahoo.com> wrote:
> My question is as follows:
>         2. How can i send an attachment through 
>            the sendmail.
> 
> Thanks in advance
> -Swapna

I don't typically use sendmail as my e-mail client,
although I think it's possible.  I use the "mail"
command for this type of work.  Here's an example
shell script which will attach a file.

Brad.
--------------
#!/bin/sh

# initialize
FILE=$1
TMPFILE=/tmp/email.$$

# validate
if [ ! -f $FILE ]; then
  echo "File not found: $FILE"
  exit 1
fi

# prepare message
cat << EOF > $TMPFILE
This is the body of the message...

The attachment is at the end.
EOF

# encode and attach the file
BASENAME=`basename $FILE`
uuencode $FILE $BASENAME >> $TMPFILE

# send the message
mail -s "Subject line here" someone at somewhere.com <
$TMPFILE

# clean up
rm -f $TMPFILE
--------------

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


More information about the Linux-users mailing list