Extending

Postie uses standard WordPress “filter hooks” during the processing of each email to give you a chance to do some special processing.

Filters

Filter hook name Version first available Notes
postie_filter_email 1.5 This filter is called after the "from" email address has been extracted from the email so that you have a chance to change who is the author.
postie_filter_email2 1.6.3 This filter is called after the postie_filter_email and includes the "To" and "Reply-To" fields.
postie_author 1.6.3 This filter is called after the WordPress user has been identified.
postie_post_before 1.5.14  This filter is called just before Postie saves the post. Replaces postie_post.
postie_post_after 1.5.14  This filter is called just after Postie saves the post.
postie_post 1.4 This filter is called just before Postie saves the post. Deprecated in favor of postie_post_before as of 1.5.14.

Getting started

First we need to glue Postie and your custom code together.

The simplest way is to create a file named filterPostie.php in the wp-content directory and place the following code into it. Postie will automatically recognize this file so you don’t have to do anything else.

<?php 
function my_postie_post_function($post) {
    return $post;
}

add_filter('postie_post_before', 'my_postie_post_function');

?>

This is the minimum code you need to write. In this case my_postie_post_function() dosen’t do anything. See the examples below for more specifics.

Alternatively you can do all this in your theme or plugin.