May 2, 2010

Direct Email Reception

There are numerous applications forĀ integration of inboundĀ email – the most obvious being ticketing systems, and robot systems (auto/interactive responders).

This is really easily achievable on UNIX systems using the .forward (dot forward) file and your scripting language of choice. If you wanted to pipe all of root’s mail into a script, you would create a .forward file in that user’s home directory, consisting of a single line, starting with a pipe, followed by the full process path.

1

Then you need to provide a destination processor for your email. In this case we have used a UNIX-style file processor at the start by using the hashbang syntax:

1

You can then use an optional MIME decoder such as Pear mimeDecode to break up the email into the relevant sections – for instance, the from/to fields and plain and/or HTML body text.