# reply.py, a simple python autoresponder This program is inteded for use with postfix, or any other MTA that can forward emails to a program for processing. ## How it works The program reads a complete email from stdin and responds to it, maintaining threading information. The program looks for autoresponses in the `templates` subdirectory. If the local part of the recipient address matches the name of a template in that directory, that template is sent in a reply to the sender. If there is no match, the template `default` is used. If no default template exists, a failed match will cause an error. The automatic choice of template can be overridden by specifying a template on the commandline. If the specified template doesn't exist, the program will throw an error. ### HTML responses Optionally, alternative HTML versions of templates may be provided. In order to use an HTML template, add your HTML content to a template file with the `.html` suffix. There *must* also be a template file for plaintext responses (same filename without the suffix). For example, if there is a `default.html` template file along with `default`, autoresponses using the `default` template will also include an HTML-formatted version of the reply. If only `default.html` exists, the program will throw an error. ## Example usage In the postfix aliases file, you can trigger this program by using the pipe operator: ``` someaddress: |"/path/to/reply.py" anotheraddress: |"/path/to/reply.py sometemplate" ``` In the first case, the program will look for the template `someaddress`. If that template doesn't exist, it will fall back to the template `default`. In the second case, the program will look for the template `sometemplate`. An error will be thrown if that template doesn't exist. In both cases, if the corresponding `.html` file exists, the response will include an HTML version of the message as well. Other MTA:s may have different mechanisms to call external programs.