Index: openacs-4/packages/acs-tcl/tcl/rollout-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/rollout-email-procs.tcl,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/packages/acs-tcl/tcl/rollout-email-procs.tcl 28 Aug 2003 09:41:43 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/rollout-email-procs.tcl 14 Jun 2004 17:49:00 -0000 1.3.4.1 @@ -115,39 +115,25 @@ return [ro::email::sendmail_log $to $from $subject $body $extraheaders $bcc] } } -} -switch [ns_config ns/server/[ns_info server]/acs/acs-rollout-support EmailDeliveryMode] { + ad_proc -private rename_ns_sendmail {} { - log { + Renames ns_sendmail to _old_ns_sendmail if _old_ns_sendmail + doesn't already exist. Returns 1 if successful, 0 otherwise. - ns_log Notice "rollout-email-procs.tcl: renaming ns_sendmail to _old_ns_sendmail." - rename ns_sendmail _old_ns_sendmail + @author Andrew Grumet + @date 6 June 2003 - ns_log Notice "rollout-email-procs.tcl: renaming ro::email::sendmail_log to ns_sendmail. Email messages will be written to the error log instead of getting sent." - rename ro::email::sendmail_log ns_sendmail - + } { + ns_log Notice "rollout-email-procs.tcl: renaming ns_sendmail to _old_ns_sendmail." + if { [catch { + #We have to execute this code in the global namespace + #because otherwise _old_ns_sendmail will land in ro::email. + namespace eval :: { rename ns_sendmail _old_ns_sendmail } + } errMsg] } { + ns_log Notice "rollout-email-procs.tcl: rename failed! Error message: '$errMsg'" + return 0 + } + return 1 } - - redirect { - - ns_log Notice "rollout-email-procs.tcl: renaming ns_sendmail to _old_ns_sendmail." - rename ns_sendmail _old_ns_sendmail - - ns_log Notice "rollout-email-procs.tcl: renaming ro::email::sendmail_redirect to ns_sendmail. Email messages will be redirected to addresses specified by the EmailRedirectTo parameter of acs/acs-rollout-support ('[ns_config ns/server/[ns_info server]/acs/acs-rollout-support EmailRedirectTo]') or else logged if that parameter is not set ." - rename ro::email::sendmail_redirect ns_sendmail - - } - - filter { - - ns_log Notice "rollout-email-procs.tcl: renaming ns_sendmail to _old_ns_sendmail." - rename ns_sendmail _old_ns_sendmail - - ns_log Notice "rollout-email-procs.tcl: renaming ro::email::sendmail_filter to ns_sendmail. Email messages will be logged unless this recipient's address is listed in the EmailAllow parameter of acs/acs-rollout-support ('[ns_config ns/server/[ns_info server]/acs/acs-rollout-support EmailAllow]') ." - rename ro::email::sendmail_filter ns_sendmail - - } - } -