Forum OpenACS Q&A: bulk_mail::sweep performance for null e-mail addresses

While it is possible to run openacs now depending on username rather than email, and thus letting the user to be registered without a valid e-mail address. (E-mail address CAN be null)
Many of the system utilities should be fixed to check the e-mail address before sending anything for the user.

I added a not null constraint on the acs_mail_lite_queue.to_addr (which is logical!)

bulk_mail:sweep has sent a user on the server over 3000 repeated messages in one night because one other user (on the recipients list) has a null e-mail address (so the procedure broke and the status of the message stuck pending)

Here how I solved it,

# both html and plain messages can now be sent the same way
if {[exists_and_not_null to_addr]} {
            acs_mail_lite::send \
                            -to_addr [ns_set get $recipient email] \
                            -from_addr $from_addr \
                            -subject $subject \
                            -body $message \
                            -extraheaders $extra_headers
}

I guess many other places should include this check?
Or any other fixing way you suggest??

Collapse
Posted by Jade Rubick on
Thanks, Samer. This is really great. Can you post this as a bug as well?
reported as bug #1182