Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] What is the most appropriate scripting language



On 1/15/07, Walter Hansen <gandalf@example.com> wrote:
I'd say shell script would be the simplest although I didn't know an
easy method for sending mime email existed until this discussion
started.

Here is how I do this (for what it is worth). You must have metasend installed for this to work:

#!/bin/bash

from="test@example.com"
subject="Test email with attachment"
to="whoever@example.com"
cc=""
mime="application/x-gzip; name=\"$1\""
encoding="base64"
filesize=`du -k $1 | cut -f 1`

if [ $filesize -lt 8192 ]
then
 metasend -b -c "$cc" -F "$from" -s "$subject" -t "$to" -m "$mime"
-e "$encoding" -f "$1"
else
 echo "Sorry the attachment is too big to send - $filesize K"
fi

# End

Regards, Keith


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links