Index: openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs-postgresql.xql 8 May 2002 02:57:45 -0000 1.2 +++ openacs-4/packages/acs-mail-lite/tcl/acs-mail-lite-procs-postgresql.xql 14 Jan 2004 17:34:52 -0000 1.3 @@ -3,15 +3,86 @@ postgresql7.1 + + + + insert into acs_mail_lite_bounce_notif + (select user_id, 0 as notification_count, + date_trunc('day',current_timestamp-1-:notification_interval) as notification_time + from acs_mail_lite_bounce + where bounce_count >= :max_bounce_count) + + + + + + + + select u.user_id, u.email, u.first_names || ' ' u.last_name as name + from cc_users u, acs_mail_lite_bounce_notif n + where u.user_id = n.user_id + and u.email_bouncing_p = 't' + and n.notification_time < current_timestamp - :notification_interval + and n.notification_count < :max_notification_count + + + + + + + + update acs_mail_lite_bounce_notif + set notification_time = date_trunc('day',current_timestamp), + notification_count = notification_count + 1 + where user_id = :user_id + + + + + + + + delete from acs_mail_lite_bounce + where user_id in (select user_id + from acs_mail_lite_mail_log + where last_mail_date < current_timestamp - :max_days_to_bounce) + + + + + insert into acs_mail_lite_queue - (message_id, to_addr, from_addr, subject, body, extra_headers, bcc) + (message_id, to_addr, from_addr, subject, body, extra_headers, bcc, package_id, valid_email_p) values - (nextval('acs_mail_lite_id_seq'), :to_addr, :from_addr, :subject, :body, :eh_list, :bcc) + (nextval('acs_mail_lite_id_seq'), :to_addr, :from_addr, :subject, :body, :eh_list, :bcc, :package_id, + (case when :valid_email_p = '1' then TRUE else FALSE end)) + + + + + update acs_mail_lite_mail_log + set last_mail_date = current_timestamp + where user_id = :user_id + + + + + + + + insert into acs_mail_lite_mail_log (user_id, last_mail_date) + values (:user_id, current_timestamp) + + + + + + select message_id, @@ -20,17 +91,27 @@ subject, body, extra_headers, - bcc + bcc, + package_id, + (case when valid_email_p = TRUE then 1 + else 0 + end) as valid_email_p from acs_mail_lite_queue - + - delete - from acs_mail_lite_queue - where message_id = :message_id + insert into acs_mail_lite_queue + (message_id, to_addr, from_addr, subject, body, extra_headers, bcc, + package_id, valid_email_p) + values + (nextval('acs_mail_lite_id_seq'), :to_addr, :from_addr, :subject, :body, + :extraheaders, :bcc, :package_id, + (case when :valid_email_p = '1' then TRUE + else FALSE end)) +