Macro parser for email processor
We have a working PHP-based system which receives emails from an SMTP server, authenticates them (using GPG keys), and allows users to upload files and messages to a web site. We seek to extend this system to be able to process macros. The following description will be a little confusing since you have not seen our system, but I am an experienced programmer, and I estimate that this is a 2-3 day job if you are expert in PHP. There will be other extensions to this project if you are interested.
Summary: Add macro capability ("automators")
The objective is that I want to be able to issue commands via email. This is a DRAFT specification, and some details will change. I am open to your input as I clarify this phase.
* Verification process is overall the same. If the email is not authenticated, it is sent for verification, etc.
* automator names are case insensitive.
* arguments for the automator are on the same line
* the content for the automator follows.
* Use a simple syntax for issuing a command, for example, in the body of the email:
#newentry This is an entry name
This is the text of the entry
* Provide a simple XML mapping file ("edit/[login to view URL]") from automator names to functions. e.g.,
«macro name=newentry path=/absolute/path/to/[login to view URL] type="perl" arguments="4" body=true»
«macro name=newentry2 path= relative/path/to/[login to view URL] function=newimage type="php" arguments="2" body=false»
«macro name=newentry2 path= /absolute/path/to/[login to view URL] type="php" arguments="2" body=false»
«macro name=newentry2 path= relative/path/to/[login to view URL] type="shell" arguments="2" body=false»
* Provide an admin page to list the automator, and edit them -- try a similar interface to the email list in Phase III.
* If an automator is invoked, check that it has the right number of arguments, and/or body. If not, send back a polite email.
* Functions can be executables or functions. If a macro is invoked, assume it will be invoked with something like:
no body:
perl relative/path/to/[login to view URL] $arguments if type=perl
include(/absolute/path/to/[login to view URL]), then newimage($args) if type=php
include(relative/path/to/[login to view URL]) if type=php and function=""
is body:
| sh /absolute/path/to/[login to view URL] $arguments if type=perl
| perl relative/path/to/[login to view URL] $arguments if type=perl
include(/absolute/path/to/[login to view URL]), then newimage($args, $body) if type=php
include(relative/path/to/[login to view URL])
include(/absolute/path/to/[login to view URL]), then cleanimage($args, $attachment_filename1) if type=php
* Automators may or may not have arguments, function, or body.
* If there is an attachment, then the attachments are saved as normal, and the file paths names are passed to the function.
* Add a simple macro test to the STATUS page.