Code Comments
Programming Forum and web based access to our favorite programming groups.I am trying to do a mail out to membership list. I have a cover letter and two attachments. The first is in word format text document and the second is a png image. I am using the dg_mail code from the wiki http://mini.net/tcl/1014. I can send mail, I can send a text attachment, but I can not properly send the cover letter with the pair of binary attachments. The example works fine (sends a copy of the .tcl code as an attachment): _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ## example code works fine - send body with text attachment. array set attcs_options {} set attcs [file join [pwd] [info script]] foreach attc $attcs { ## charset is optional set opts [list -canonical "text/plain; charset=ascii; name=\"[file tail $att c]\""] lappend opts -encoding quoted-printable lappend opts -header {Content-Disposition attachment} lappend opts -file $attc set attcs_options($attc) $opts } dg_mail::sendmail sinisa@datagram.dg djoko2000@datagram.dg {Tcl smtp!} Hello ! "" "" \ -file [namespace current]::attcs_options _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- When I try to send my binary attachments, the mail is sent but the attachments are included in the text as binary gibberish. Clicking on the attached file names in firefox, firefox complains that the attachments are not in the correct format. I suspect I need some more options set, but what options and what values? Any thoughts? _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- #send mail attachment1 attachment1 set smtphost "..." set from ... set toList ... set subject "..." set body "..." set header [list Date "[clock format [clock seconds]]"] set bcc "" set opt_attcs_type -file set attc $attachment1 ;# word doc array set attcs_options {} set opts [list -canonical "text/doc; name=\"$attc\""] #lappend opts -encoding binary ;# makes no difference #lappend opts -header {Content-Disposition attachment} ;# makes no difference lappend opts -file [file join [pwd] $attc] set attcs_options($attc) $opts set attc $attachment2 ;# png image array set attcs_options {} set opts [list -canonical "image/png; name=\"$attc\""] #lappend opts -encoding binary ;# makes no difference #lappend opts -header {Content-Disposition attachment} ;# makes no difference lappend opts -file [file join [pwd] $attc] set attcs_options($attc) $opts # dg_mail::sendmail to from subject body {headers} {bcc} {opt__type} {attcs_ array_name} dg_mail::sendmail $toList $from $subject $body $header $bcc \ $opt_attcs_type [namespace current]::attcs_options _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Post Follow-up to this messageAll fixed!
set smtphost "..."
set from "\"Membership Committee\" <membership@...>"
set toList "<...@...>"
set subject "docs attached"
set header [list Date "[clock format [clock seconds]]"]
set bcc ""
set attcs_type -file
set attc $attachment1 ;# word doc
array set attcs_options {}
set opts [list -canonical "application/octet-stream; name=\"[file tail $attc
]\""]
lappend opts -header {Content-Disposition attachment}
lappend opts -file [file join [pwd] $attc]
set attcs_options($attc) $opts
set attc $attachment2 ;# png image
array set attcs_options {}
set opts [list -canonical "image/png; name=\"[file tail $attc]\""]
lappend opts -header {Content-Disposition attachment}
lappend opts -file [file join [pwd] $attc]
set attcs_options($attc) $opts
dg_mail::sendmail $toList $from $subject $body $header $bcc $attcs_type [nam
espace current]::attcs_options
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.