Forum OpenACS Development: Notifications Bounce Loop!

Collapse
Posted by Dave Bauer on
Here is an interesting bit of code:

# Find the from user
            set from_user [cc_lookup_email_user $from]

            # We don't accept empty users for now
            if {[empty_string_p $from_user]} {
                ns_log debug "load_qmail_mail_queue: no user for from address: $from, to: $to. bouncing message."
		# bounce message with an informative error.
		bounce_mail_message  -to_addr $email_headers(from) \
		    -from_addr $email_headers(to) \
		    -body $body  \
		    -message_headers $orig_headers \
		    -reason "Invalid sender.  You must be a member of the site and\nyour From address must match your registered address."

                if {[catch {ns_unlink $msg} errmsg]} {
                    ns_log Warning "load_qmail_mail_queue: couldn't remove message $msg: $errmsg"
                }
                continue
            }

Well, we had an incoming email from the mail system where the From Header looked like this:

From: mailto:MAILER-DAEMON@example.com (Mail Delivery System)

so the bounce hanlding code says, hey that's not an OpenACS user, bounce it back.

So it does to "mailto:MAILER-DAEMON@example.com (Mail Delivery System).

Now acs_mail_list::send expects a list as the argument to -to_addr (bet you didn't know that)

So the code tries to extract the list of email addresses to send to and comes up with
mailto:MAILER-DAEMON@example.com
(Mail
Delivery
System)

So the last three bounce back and the mailto:MAILER-DAEMON@example.com (Mail Delivery System) sends more bounces which go into the incoming queue and are handled the same way.

Passing a string as an argument the the proc expects a list is always bad news.

Collapse
Posted by Dave Bauer on
I think the simple fix is this:

bounce_mail_message -to_addr [list $email_headers(from)]

make sure that we pass a list to acs_mail_lite::send

(maybe fix it in bouce_mail_message?

Collapse
Posted by Dave Bauer on
There is a regexp that cleans up the address
but it only handles address like this:

From: Full Name <email@domain>

althouh

From: MAILER-DAEMON (Mail Delivery System)

is a valid format.