Download & Extend

Configure mailhandler to optionally not post nodes

Project:Mailhandler
Version:5.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (works as designed)

Issue Summary

I'm using mailhandler in conjunction with several modules that use the mailhandler hook to process incoming messages.

If none of my modules process the message, I would like mailhandler to ignore the node (rather than attempt to post it as a blog post).

The attached diffs allow users to configure each mailbox with the default node type they would like un-handled messages to be posted as (or optionally set to none, in which case mailhandler will ignore the node).

AttachmentSize
mailhandler.install.optionally-skip-node-creation.patch1.1 KB
mailhandler.module.optionally-skip-node-creation.patch8.54 KB

Comments

#1

Category:feature request» task
Status:active» needs review

Looks like a valid improvement also for higher versions. So if someone can test it on 5.x and it works we could see to make it a feature request

#2

From my understanding, if your hook_mailhandler() implementation returns NULL, no node or comment is saved at all. Please, review the mailhandler.module file, and search for something like this (it is in 6.x-1.x-dev, but I have no idea when this was introduced)

<?php
// modules may override node elements before submitting. they do so by returning the node.
 
foreach (module_list() as $name) {
    if (
module_hook($name, 'mailhandler')) {
     
$function = $name .'_mailhandler';
      if (!(
$node = $function($node, $result, $i, $header, $mailbox))) {
       
// Exit if a module has handled the submitted data.
       
break;
      }
    }
  }

  if (
$node) {
    if (
$node->type == 'comment') {
     
$nid = mailhandler_comment_submit($node, $header, $mailbox, $origbody);
     
$type = 'comment';
    }
    else {
     
$nid = mailhandler_node_submit($node, $header, $mailbox, $origbody);
     
$type = 'node';
    }
  }
?>

#3

Status:needs review» closed (works as designed)

Well, actually, as this is already fixed in the 6.x version, there is nothing more to do here!

nobody click here