Managed to fix this myself its very messy and not user friendly but if you happy editing source files it seems to work very well, with one big warning, if you set an email address it will ignore any messages in the subject to set a category I had to do this otherwise it would have set one post to multiple category.
You need to edit postie-functions.php around line 1970 you will see this code
'function GetPostCategories(&$subject, $defaultCategory) {
global $wpdb;
$post_categories = array();
$matches = array();
//try and determine category
if ( preg_match('/(.+): (.*)/', $subject, $matches)) {
$subject = trim($matches[2]);
$matches[1] = array($matches[1]);
}
else if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) {
preg_match("/](.[^\[]*)$/",$subject,$subject_matches);
$subject = trim($subject_matches[1]);
}
else if ( preg_match_all('/-(.[^-]*)-/', $subject, $matches) ) {
preg_match("/-(.[^-]*)$/",$subject,$subject_matches);
$subject = trim($subject_matches[1]);
}
if (count($matches)) {
foreach($matches[1] as $match) {
$match = trim($match);
$category = NULL;
print("Working on $match\n");
$sql_name = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE name=\'' . addslashes($match) . '\'';
$sql_id = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE term_id=\'' . addslashes($match) . '\'';
$sql_sub_name = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE name LIKE \'' . addslashes($match) . '%\' limit 1';
if ( $category = $wpdb->get_var($sql_name) ) {
//then category is a named and found
} elseif ( $category = $wpdb->get_var($sql_id) ) {
//then cateogry was an ID and found
} elseif ( $category = $wpdb->get_var($sql_sub_name) ) {
//then cateogry is a start of a name and found
}
if ($category) {
$post_categories[] = $category;
}
}
}
if (!count($post_categories)) {
$post_categories[] = $defaultCategory;
}
return($post_categories);
}'
I have changed it to this
'function GetPostCategories(&$subject, $defaultCategory, $mimeDecodedEmail) {
$var1 = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
global $wpdb;
$post_categories = array();
$matches = array();
//try and determine category
//if ( preg_match('/(.+): (.*)/', $subject, $matches)) {
// $subject = trim($matches[2]);
//$matches[1] = array($matches[1]);
//}
//else if (preg_match_all('/\[(.[^\[]*)\]/', $subject, $matches)) {
// preg_match("/](.[^\[]*)$/",$subject,$subject_matches);
// $subject = trim($subject_matches[1]);
//}
if ( preg_match_all('/-(.[^-]*)-/', $subject, $matches) ) {
preg_match("/-(.[^-]*)$/",$subject,$subject_matches);
$subject = trim($subject_matches[1]);
}
if (count($matches)) {
foreach($matches[1] as $match) {
$match = trim($match);
$category = NULL;
print("Working on $match\n");
$sql_name = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE name=\'' . addslashes($match) . '\'';
$sql_id = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE term_id=\'' . addslashes($match) . '\'';
$sql_sub_name = 'SELECT term_id
FROM ' . $wpdb->terms. '
WHERE name LIKE \'' . addslashes($match) . '%\' limit 1';
if ( $category = $wpdb->get_var($sql_name) ) {
//then category is a named and found
} elseif ( $category = $wpdb->get_var($sql_id) ) {
//then cateogry was an ID and found
} elseif ( $category = $wpdb->get_var($sql_sub_name) ) {
//then cateogry is a start of a name and found
}
if ($category) {
$post_categories[] = $category;
}
}
}
if (!count($post_categories)) {
$post_categories[] = $defaultCategory;
}
//email address one
if ( preg_match('/name@domain.com/', $var1))
{
unset($post_categories);
$post_categories[] = 3;
}
//email address two
elseif ( preg_match('/email@domain.com/', $var1))
{
unset($post_categories);
$post_categories[] = 4;
}
return($post_categories);
print ("it is from $var1 \n");
return($post_categories);
}'
You will notice I also // a couple of the early name matches so it only looks for -number- in the subject as I wont be able to control the subject and some emails come in with : or other randoms it destroyed them so that was my way of avoiding this. I presume you can put as many elseif in as you want but I have only done the two so far.
Hope this helps
Rob