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.108.2.32 -r1.108.2.33 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 16 Jul 2024 17:11:03 -0000 1.108.2.32 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 17 Jul 2024 13:53:51 -0000 1.108.2.33 @@ -210,7 +210,7 @@ ns_log notice "SMTP call <$cmd>" ns_log Debug "send cmd: $cmd" - if {[catch $cmd errorMsg]} { + if {[catch $cmd errorMsg]} { ns_log Error "acs-mail-lite::smtp: error $errorMsg while executing\n$cmd" error $errorMsg } @@ -1021,6 +1021,35 @@ } return $domain } + + ad_proc configured_p {} { + + Determine, whether the outgoing SMTPHost is configured and + reachable. + + } { + # + # We have currently no good way to check, whether the outgoing + # email server is fully configured and accepts our + # emails. Here we check only, whether we can connect to the + # configured server. + # + set success 0 + set params [get_delivery_parameters] + + try { + lassign [ns_sockopen -timeout 100ms [dict get $params SMTPHost] [dict get $params SMTPPort]] rid wid + set readCheck [ns_sockcheck $rid] + set writeCheck [ns_sockcheck $wid] + set success [expr {$readCheck && $writeCheck}] + } on error {errorMsg} { + } finally { + catch {close $rid} + catch {close $wid} + } + + return $success + } } # Local variables: