Any interest in a generic sendmail interface to applicaitons?
| From: | Tony Bibbs | Date: | Fri, 07 Feb 2003 00:52:38 +0000 |
| Subject: | Any interest in a generic sendmail interface to applicaitons? | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-13040@lists.php.net to get a copy of this message | ||
Maybe this has been done (I looked at mailparse but was too lazy to download the source and there wasn't a link to CVS) as part of some other package but I have a set of PHP classes that can be used as a sendmail handler. Simply put, it provides a way for you to communicate with PHP applications via email. This package is pretty simple, it parses an email message looking for a "command: <some command>" pattern. The package then attempts to instanstiate that command and execute a processRequest() method.
Applications would be responsible for implementing the individual commands (an abstract base command helps you get started) and the only gaurantee they get is they will get instanstiated when requested and they will receive the key-value pairs found.
A sample messages is:
command: saveuser
site: http://www.example.com
username: john_doe
first name: john
last name: doe
email: john.doe@example.com
This would end up with a command called saveuser() being called with a single array as parameter. This array would look like this:
Array
(
'username'=>'john_doe',
'first_name'=>'john',
'last_name'=>'doe',
'email'=>'john.doe@example.com'
)
That command then would take care of processing the request. The abstract base command has a _request() method that could do a POST or GET to a remote site should the mail server be separate from the application or, if the application is local, the command can include the appriopriate PHP pages and just call some functions/methods. Base command also have a getHelp() which would allow the 'help' command to be sent and a list of all installed commands with their arguments would be returned.
Any interest?
--
+-------------------+--------------------------------------------------+
|Tony Bibbs |[R]egardless of what you may think of our penal |
|tony@tonybibbs.com |system, the fact is that every man in jail is one |
| |less potential fisherman to clutter up your |
| |favorite pool or pond. --Ed Zern |
+-------------------+--------------------------------------------------+