Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl,v diff -u -r1.92 -r1.93 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 27 Apr 2015 15:28:17 -0000 1.92 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 7 Aug 2017 23:47:57 -0000 1.93 @@ -156,9 +156,9 @@ } ns_log Debug "send cmd: $cmd" - if {[catch $cmd errorInfo]} { - ns_log Error "acs-mail-lite::smtp: error $errorInfo while executing\n$cmd" - error $errorInfo + if {[catch $cmd errorMsg]} { + ns_log Error "acs-mail-lite::smtp: error $errorMsg while executing\n$cmd" + error $errorMsg } } @@ -329,6 +329,7 @@ -subject $subject \ -body $body \ -package_id $package_id \ + -object_id $object_id \ -file_ids $file_ids \ -filesystem_files $filesystem_files \ -delete_filesystem_files_p $delete_filesystem_files_p \ @@ -460,7 +461,7 @@ db_foreach get_file_info {} { lappend tokens [mime::initialize \ - -param [list name [ad_quotehtml $title]] \ + -param [list name [ns_quotehtml $title]] \ -header [list "Content-Disposition" "attachment; filename=\"$name\""] \ -header [list Content-Description $title] \ -canonical $mime_type \ @@ -593,7 +594,9 @@ -package_id $package_id \ -message_id $message_id] - + set errorMsg "" + set status ok + if { $send_mode eq "log" } { # Add recipients to headers @@ -611,11 +614,13 @@ ns_log Notice "acs-mail-lite::send: $notice\n\n**********\nEnvelope sender: $originator\n\n$packaged\n**********" } else { - - acs_mail_lite::smtp -multi_token $tokens \ - -headers $headers_list \ - -originator $originator + if {[catch {acs_mail_lite::smtp -multi_token $tokens \ + -headers $headers_list \ + -originator $originator} errorMsg]} { + set status error + } + # Close all mime tokens mime::finalize $tokens -subordinates all @@ -635,17 +640,22 @@ -file_ids $file_ids \ -filesystem_files $filesystem_files \ -delete_filesystem_files_p $delete_filesystem_files_p \ - -object_id $object_id + -object_id $object_id \ + -status $status \ + -errorMsg $errorMsg } # Attachment files can now be deleted, if so required. # I leave this as the last thing to do, because callbacks # could need to look at files for their own purposes. if {[string is true $delete_filesystem_files_p]} { foreach f $filesystem_files { - file delete $f + file delete -- $f } } + if {$status ne "ok"} { + error $errorMsg + } } #--------------------------------------- @@ -678,7 +688,7 @@ {bcc {}} } { - Replacement for ns_sendmail for backward compability. + Replacement for ns_sendmail for backward compatibility. } { @@ -702,3 +712,9 @@ } } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: