Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.tcl 14 May 2006 16:12:57 -0000 1.9 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.tcl 3 Dec 2006 13:23:24 -0000 1.10 @@ -105,22 +105,22 @@ upvar $array email set to [acs_mail_lite::parse_email_address -email $email(to)] - ns_log Notice "acs_mail_lite::incoming_email -impl acs-mail-lite called. Recepient $to" + ns_log Debug "acs_mail_lite::incoming_email -impl acs-mail-lite called. Recepient $to" util_unlist [acs_mail_lite::parse_bounce_address -bounce_address $to] user_id package_id signature # If no user_id found or signature invalid, ignore message - if {[empty_string_p $user_id] || ![acs_mail_lite::valid_signature -signature $signature -message_id $email(message-id)]} { + if {[empty_string_p $user_id]} { if {[empty_string_p $user_id]} { - ns_log Notice "acs_mail_lite::incoming_email impl acs-mail-lite: No equivalent user found for $to" + ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: No equivalent user found for $to" } else { - ns_log Notice "acs_mail_lite::incoming_email impl acs-mail-lite: Invalid mail signature $signature" + ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: Invalid mail signature $signature" } } else { - ns_log Notice "acs_mail_lite::incoming_email impl acs-mail-lite: Bounce checking $to, $user_id" + ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: Bounce checking $to, $user_id" if { ![acs_mail_lite::bouncing_user_p -user_id $user_id] } { - ns_log Notice "acs_mail_lite::incoming_email impl acs-mail-lite: Bouncing email from user $user_id" + ns_log Debug "acs_mail_lite::incoming_email impl acs-mail-lite: Bouncing email from user $user_id" # record the bounce in the database db_dml record_bounce {} Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.xql 28 Sep 2005 18:14:04 -0000 1.2 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-callback-procs.xql 3 Dec 2006 13:23:24 -0000 1.3 @@ -5,15 +5,15 @@ update acs_mail_lite_bounce set bounce_count = bounce_count + 1 - where user_id = :user_id + where party_id = :user_id - insert into acs_mail_lite_bounce (user_id, bounce_count) + insert into acs_mail_lite_bounce (party_id, bounce_count) values (:user_id, 1) @@ -45,4 +45,4 @@ - \ No newline at end of file + 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.58 -r1.59 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 2 Dec 2006 09:17:16 -0000 1.58 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl 3 Dec 2006 13:23:24 -0000 1.59 @@ -855,22 +855,46 @@ set sock [ns_sockopen $smtp $smtpport] set rfp [lindex $sock 0] set wfp [lindex $sock 1] - + ## Perform the SMTP conversation with_finally -code { _ns_smtp_recv $rfp 220 $timeout _ns_smtp_send $wfp "HELO [ns_info hostname]" $timeout _ns_smtp_recv $rfp 250 $timeout _ns_smtp_send $wfp "MAIL FROM:<$mail_from>" $timeout _ns_smtp_recv $rfp 250 $timeout - _ns_smtp_send $wfp "RCPT TO:<$rcpt>" $timeout - _ns_smtp_recv $rfp 250 $timeout + + # By now we are sure that the server connection works, otherwise + # we would have gotten an error already + + if {[catch { + _ns_smtp_send $wfp "RCPT TO:<$rcpt>" $timeout + _ns_smtp_recv $rfp 250 $timeout + } errmsg]} { + + # This user has a problem with retrieving the email + # Record this fact as a bounce e-mail + if { $rcpt_id ne "" && ![bouncing_user_p -user_id $rcpt_id] } { + ns_log Notice "acs-mail-lite: Bouncing email from user $rcpt_id due to $errmsg" + # record the bounce in the database + db_dml record_bounce {} + + if {![db_resultrows]} { + db_dml insert_bounce {} + } + + } + + return + } + _ns_smtp_send $wfp DATA $timeout _ns_smtp_recv $rfp 354 $timeout _ns_smtp_send $wfp $msg $timeout _ns_smtp_recv $rfp 250 $timeout _ns_smtp_send $wfp QUIT $timeout _ns_smtp_recv $rfp 221 $timeout + } -finally { ## Close the connection close $rfp Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.xql,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.xql 13 May 2006 11:23:40 -0000 1.11 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs.xql 3 Dec 2006 13:23:24 -0000 1.12 @@ -62,6 +62,25 @@ + + + + update acs_mail_lite_bounce + set bounce_count = bounce_count + 1 + where party_id = :rcpt_id + + + + + + + + insert into acs_mail_lite_bounce (party_id, bounce_count) + values (:rcpt_id, 1) + + + +