My idea stems from the fact, that we are using Novell GroupWise as an internal Mail system. While there is an SMTP gateway for this product, I decided not to use it for PN, but to use the GW API Gateway instead. Writing the PHP code fo this Gateway wasn't too difficult, but including it will be (I haven't done it yet!).
So, my idea is as follow:
Provide a PN API function (let's call it pnSendMail), which is called like other API functions. This function itself should be extendalbe by "plug-ins" for different mail systems. The function can then be called like
pnSendMail ($recipient, $sender, $subject, $method, $extrainfo)
where method is the selector for the desired mail system, and the optional parameter extrainfo could be an associative array of additional information for the plug-in in question.
By an administrative function one could make one of the mail methods a defaukt one, making the "method" parameter optional.
The mail plug-in functionality could be analogous to the modules or blocks functionality; a programmer can provide own plug-ins using certain API standards.
Think about the possibilities with such a system:
On an intranet, you could provide "native" gateways to your preferred mail system. You can as well provide gateways to printers, so that a pnMailSend call with $method='print' could print out an information.
On the Internet, instead of writing block or modules that send SMS or fax, you could simply write a plug-in so that pnSendMail uses the public SMS or Fax service a.s.o.
For using the standard mail functionality offered ba PHP and senmail, just use the plug-in which passes the parameters provided to the standard mail() function.
What do you think about such a system? Any comments are welcome.