one more email issue...

one more email issue...

Post by J » Wed, 27 Mar 2002 05:53:50



Again, please this is not being used for spam.  It is being used at a
legitimate small asp.

I have the below snippet that basically just reads two columns out of
a Oracle table, the userid and email, then sends the email out using
the here doc.

I have been asked if I could supply an excel file in the email.  I
tried the following in the script:

uuencode file.xls file.xls | mailx -r ......

This doesnt work however.  Is it possible to attach a file using the
snippet below or am I missing a fundamental here.

once again this is NOT for the purpose of spam, I hate that as much as
the next person.

# Snip
while read user email
 do
  sleep 1

$email <<EOF

This is the body of the email......

Thanks,

Your IT Team.

EOF
 done <  mail_file.txt
# Snip

 
 
 

one more email issue...

Post by cyp.. » Wed, 27 Mar 2002 17:28:25


Oh, you're a cheap-ass newsserver Google luser.

Repeating the post without X-No_Archive: yes for you:

----

#  
#   I have been asked if I could supply an excel file in the email.  I
#   tried the following in the script:
#  
#   uuencode file.xls file.xls | mailx -r ......
#  
#   This doesnt work however.  Is it possible to attach a file using...

...using Tcl, of course.

Tcl/Tk and the tcllib package (mime/smtp) are available via scriptics.com.

----

#!/usr/local/bin/tclsh

   package require mime 1.0
   package require smtp 1.0

set body_message {This is the text body of the email...}

set part1 [mime::initialize -string $body_message]

set excel [mime::initialize \
    -canonical application/vnd.ms-excel \
    -file file.xls]

# create a multipart containing both

set multiT [mime::initialize -canonical multipart/mixed
    -parts [list $part1 $excel]]

# mail it (see tcllib-1.2/modules/mime/README.txt)

smtp::sendmessage $multiT \



    -header [list Subject "test message..."] \
    -servers $SMTP_SERVER; # Put your outbound SMTP server here.

----

Obviously you can generalize the above script to
accept multiple attachments from the command line.

You can even wrap it in 'wish' code (Tcl/Tk) to
GUI prompt for files to attach.

 
 
 

one more email issue...

Post by J » Thu, 28 Mar 2002 01:41:28



> Oh, you're a cheap-ass newsserver Google luser.

> Repeating the post without X-No_Archive: yes for you:

> ----


> #  
> #   I have been asked if I could supply an excel file in the email.  I
> #   tried the following in the script:
> #  
> #   uuencode file.xls file.xls | mailx -r ......
> #  
> #   This doesnt work however.  Is it possible to attach a file using...

> ...using Tcl, of course.

> Tcl/Tk and the tcllib package (mime/smtp) are available via scriptics.com.

> ----

> #!/usr/local/bin/tclsh

>    package require mime 1.0
>    package require smtp 1.0

> set body_message {This is the text body of the email...}

> set part1 [mime::initialize -string $body_message]

> set excel [mime::initialize \
>     -canonical application/vnd.ms-excel \
>     -file file.xls]

> # create a multipart containing both

> set multiT [mime::initialize -canonical multipart/mixed
>     -parts [list $part1 $excel]]

> # mail it (see tcllib-1.2/modules/mime/README.txt)

> smtp::sendmessage $multiT \



>     -header [list Subject "test message..."] \
>     -servers $SMTP_SERVER; # Put your outbound SMTP server here.

> ----

> Obviously you can generalize the above script to
> accept multiple attachments from the command line.

> You can even wrap it in 'wish' code (Tcl/Tk) to
> GUI prompt for files to attach.

Thank you very much, much appreciated.

JC

 
 
 

one more email issue...

Post by cyp.. » Thu, 28 Mar 2002 08:32:16


#  
#   Thank you very much, much appreciated.

Glad to help. BTW, trim down the text you are replying to,
no need to repeat the whole thing.

If you get stuck, post again.

Anyway, I found the mime type in:

boing:root 68> p
/opt/NSCPcom/etc      (Netscape install directory)
boing:root 69> ll
total 18
drwxr-xr-x   2 bin      bin          512 Nov  3 08:51 .
drwxr-xr-x  10 bin      bin          512 Mar  5 18:06 ..
-rwxr-xr-x   1 bin      bin          904 Aug 10  2001 mailcap
-rwxr-xr-x   1 bin      bin         1053 Aug 10  2001 mailcap.55
-rwxr-xr-x   1 bin      bin         3216 Aug 10  2001 mime.types

...the mime.types file.

You could parse it to programmatically find the mime type
for files using the extension they should to indicate
their app.

Ohh, that mailcap file looks like the place I
can tell shockwave to go into the bitbucket! Yes! ;-)