cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound email for forums

idwright
Star Collaborator
Star Collaborator
I'm trying to enable inbound email for site discussion forums.

Looking at this doc - http://docs.alfresco.com/5.1/concepts/email-target-node.html - it seems like it should be possible.

I can send mail to the server i.e. by enabling the aspect emailserver:aliasable on a folder and setting the emailserver:alias property so that part is working.

I've tried sending mail to post-xxxxx and the uuid of the fm:topic but the mail gets bounced.

I can't seem to add the aliasable aspect to the post using a javascript action.

The other thing I tried was to have all replies go to a processing folder but then the addNode method fails on the fm:topic node so that doesn't work either.

Any ideas?

Thanks.
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Using inbound SMTP with discussions requires that emails be
a) targeted at the forum using the email address and use a subject corresponding to a topic
b) targeted at the topic using the email address
c) targeted at a post using the email address

Any inbound email will result in a new post within a topic (in case 'a' potentially a new topic). It is not possible / supported (out-of-the-box) that messages are targeted directly at posts and result in direct responses.

Applying the aliasable aspect is not required technically - you can also address nodes using their node-dbid property value.

In any case you always have to make sure that the sender of the email is included in the allowed-senders configuration property (or you use a wildcard) and that their user has AddChildren permissions on the forum / topic.

Regards
Axel

idwright
Star Collaborator
Star Collaborator
Thanks for the help - using the node-dbid seems to be the main thing I was missing, I'd been using node-uuid instead.

What is quite interesting is that if you reply to the node-dbid then the reply gets added (you can see Replies: (2) for example), and triggers my mail notifications script, but the text of the reply doesn't show up in the UI unless you add an association.
So for reference I'm included the script I've ended up with
<blockcode>
function processNode(doc, dbid, node) {
     if (node.properties["sys:node-dbid"] == target) {
      doc.properties["cmSmiley Tongueublished"] = doc.properties["cm:created"];

      doc.addAspect("cm:syndication");
      doc.addAspect("cm:referencing");
                if (node.getType() == "{http://www.alfresco.org/model/forum/1.0}topic") {
      //  doc.addNode(node);
                } else if (node.getType() == "{http://www.alfresco.org/model/forum/1.0}post") {
        doc.createAssociation(node, "cm:references");
               }
          doc.save(); 
               return true;
   }
      return false;
}

if (document.hasAspect("cm:emailed")) {
  var addy = document.properties["cm:addressee"];
  var target = addy.substr(0, addy.indexOf('@'));
  if (! processNode(document, target, document.parent)) {
      for (i in document.parent.children) {
       if (processNode(document, target, document.parent.children)) {
           break;
        }
      }
  }

}

</blockcode>