[dokuwiki] MAIL_MESSAGE_SEND event proposal

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 16 Sep 2007 13:02:53 +0100

Hi Andi, *,

In response to FS#1007 (http://bugs.splitbrain.org/index.php?do=details&task_id=1007) I am proposing to add a new event, MAIL_MESSAGE_SEND, to allow plugins to replace PHP's mail() as DokuWiki's notification mechanism.

Right now I see a couple of alternatives:
- put an event wrapper around mail_send() (inc/mail.php), or
- put an event wrapper around mail_send's call to mail()

Both options have advantages. Before calling mail(), mail_send() cleans up some of the message parameters and encodes them for transport using SMTP. By placing the event wrapper around mail_send() the encoding is lost and any plugin also using SMTP would need to duplicate the encoding carried out by mail_send(). Placing the event wrapper around mail(), means the plugin would receive encoded message parameters, which in some cases may not be desirable.

Some further alternatives spring to mind
- put the event wrapper around the call to mail() and provide both unencoded and encoded message parameters in the event data - use two events, one around mail_send(), MAIL_MESSAGE_SEND, and one around its call to mail(), MAIL_MESSAGE_SENDSMTP. - encapsulate the encoding functionality in a different function allowing plugins to use it with a single function call.

I am not particularly happy with any of the implementations I've thought of. If push came to shove, I'd opt for a single event, with the event wrapper around mail_send(), maybe with a separated encoding function.

I am looking for comments and any further ideas on the best way to implement this event.



-- Chris

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: