Index: openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql 6 Nov 2003 14:28:03 -0000 1.1 @@ -0,0 +1,7 @@ +create table notification_email_hold ( + reply_id integer + references notification_replies(reply_id) + primary key, + to_addr text, + body text +); Index: openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-drop.sql 6 Nov 2003 14:28:03 -0000 1.1 @@ -0,0 +1 @@ +drop table notification_email_hold ; Index: openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql 6 Nov 2003 14:28:03 -0000 1.1 @@ -0,0 +1,7 @@ +create table notification_email_hold ( + reply_id integer + references notification_replies(reply_id) + primary key, + to_addr text, + body text +); Index: openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-drop.sql 6 Nov 2003 14:28:03 -0000 1.1 @@ -0,0 +1 @@ +drop table notification_email_hold ; Index: openacs-4/packages/notifications/tcl/notification-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-email-procs.tcl,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 1 Nov 2003 08:45:39 -0000 1.15 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 6 Nov 2003 14:28:03 -0000 1.16 @@ -128,6 +128,48 @@ -extraheaders $extra_headers } + ad_proc -public bounce_mail_message { + {-to_addr:required} + {-from_addr:required} + {-body:required} + {-message_headers:required} + {-reason ""} + } { + This sends a bounce message indicating a a failuring in sending + a message to the system. + + @author mkovach@alal.com + @creation-date 05 Nov 2003 + + @param to_addr who the bounce is going to + @param from_addr who the bouncing message as sent to + @param the message body + @param message_headers the headers of the message + } { + set domain [address_domain] + set bounce_to [parse_email_address $to_addr] + set bounce_address [parse_email_address $from_addr] + set bounce_from "MAILER-DAEMON@$domain" + set bounce_subject "failure notice" + set l "Hi. This is the notification program at $domain.\n" + append l "I'm afraid I wasn't able to deliver your message to the\n" + append l "following addresses. This is a permament error; I've\n" + append l "given up. Sorry it didn't work out.\n\n" + append l "<$from_addr>:\n" + append l "$reason\n\n" + append l "--- Below is this line is a copy of the message.\n\n" + #append l "Return-Path: <$from_addr>\n" + #append l "$message_headers\n\n" + append l "$body\n" + acs_mail_lite::send \ + -to_addr $bounce_to \ + -from_addr $bounce_from \ + -subject $bounce_subject \ + -body $l \ + -extraheaders "" + ns_log Notice "bounce: To: $bounce_to From: $bounce_from Subject $bounce_subject body: $l" + } + ad_proc -private load_qmail_mail_queue { {-queue_dir:required} } { @@ -244,6 +286,8 @@ # We don't accept empty users for now if {[empty_string_p $from_user]} { ns_log Notice "load_qmail_mail_queue: no user $from" + # bounce message here + bounce_mail_message -to_addr $email_headers(from) -from_addr $email_headers(to) -body $body -message_headers $headers -reason "invalid sender. You must be a member of the site." if {[catch {ns_unlink $msg} errmsg]} { ns_log Warning "load_qmail_mail_queue: couldn't remove message $msg: $errmsg" } @@ -255,6 +299,9 @@ # We don't accept a bad incoming email address if {[empty_string_p $to_stuff]} { ns_log Notice "load_qmail_mail_queue: bad to address $to" + # bounce message here + bounce_mail_message -to_addr $email_headers(from) -from_addr $email_headers(to) -body $body -message_headers $headers -reason "Invalid Address" + if {[catch {ns_unlink $msg} errmsg]} { ns_log Warning "load_qmail_mail_queue: couldn't remove message $msg: $errmsg" } @@ -263,6 +310,7 @@ set object_id [lindex $to_stuff 0] set type_id [lindex $to_stuff 1] + set to_addr "$to" db_transaction { set reply_id [notification::reply::new \ @@ -271,7 +319,7 @@ -from_user $from_user \ -subject $email_headers(subject) \ -content $body] - + db_dml holdinsert {} catch {ns_unlink $msg} lappend list_of_reply_ids $reply_id Index: openacs-4/packages/notifications/tcl/notification-email-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-email-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-email-procs.xql 28 Aug 2003 09:41:58 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-email-procs.xql 6 Nov 2003 14:28:03 -0000 1.3 @@ -9,5 +9,14 @@ + + + insert into notification_email_hold + (reply_id,to_addr,body) + values + (:reply_id,:to_addr,:body) + + + Index: openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 1 Nov 2003 08:45:39 -0000 1.6 +++ openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 6 Nov 2003 14:28:03 -0000 1.7 @@ -45,6 +45,7 @@ if { [ catch { notification::type::process_reply -type_id $type_id -reply_id $reply_id + db_dml deletehold {} notification::reply::delete -reply_id $reply_id } err ] } { ns_log Error "notification::reply::sweep::process_all_replies: bombed on reply_id $reply_id:\n$err" Index: openacs-4/packages/notifications/tcl/reply-sweep-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/reply-sweep-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/notifications/tcl/reply-sweep-procs.xql 29 Jun 2002 00:21:46 -0000 1.1 +++ openacs-4/packages/notifications/tcl/reply-sweep-procs.xql 6 Nov 2003 14:28:03 -0000 1.2 @@ -14,4 +14,11 @@ + + + delete from notification_email_hold + where reply_id = :reply_id + + +