Forum OpenACS Development: Wrapper for ns_sendmail

Collapse
Posted by Nima Mazloumi on
The bug https://openacs.org/bugtracker/openacs/bug?bug_number=737 deals with checking if important parameters are set before the user is spamed. For example: dont_spam_me_p.

In order to really fix this, we need a single outgoing mail point.  Is this ns_sendmail?  If so, we can rename ns_sendmail and create a wrapper which tests spam_p first.

Pro: Quick fix
Cons: Will this break anything?

Collapse
Posted by Jeff Davis on
There are some things which should ignore the dont_spam_me_p flag (like a password change email which can only be gotten via email) so doing it in one place with no way to overide it is not workable.

We should just fix the places where mail is sent to check the flag.

Collapse
Posted by Tom Ayles on
Hi Nima,

ns_sendmail when invoked opens a connection to the server's mailhost (127.0.0.1 by default) and sends the message using SMTP. So ignoring anything which directly inserts into qmail's outgoing queue (not sure this happens any more), every mail goes through ns_sendmail. Problem is, ns_sendmail only takes the To: address as a parameter and not a party ID. So to do the check here, I guess you'd need to look up the party ID using the email and then check the dont_spam parameter. I suppose that if you have to go to the database to check the parameter anyway, then the extra effort of looking up the party from it's email address is minimal, but I personally would be a little worried about incurring a DB hit per mail sent, as I think on high-volume sites this might be a serious performance issue.

I think maybe a better place to perform the check would be higher up, e.g. in acs-mail, though again I believe most of these still operate with email addresses not party ID's.

Tom