Needs review
Project:
Drupal Commons
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
8 Apr 2013 at 14:41 UTC
Updated:
23 Oct 2013 at 14:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ezra-g commentedSee also: #1964554: Post comments via email reply to notification
Comment #2
ezra-g commentedSome notes on the way I look at the feature here:
- Tool to periodically check a mailbox for emails from users that should be turned into comments on the site. Mailhandler is one such tool but there may be others.
- Ability to detect the intention of the emailing user and route the message appropriately.
Historically, modules such as Mailcomment have looked for 2-3 things in the email to determine where it should be routed:
A) A token in the message body referring to a specific comment and nid combination.
B) A token in the *headers of the message* referring to a specific comment and nid combination.
C) A section of the email that indicates where the new reply ends and the previous email (eg, the email notification) ends.
A and B are necessary because different email clients treat the returning email differently. Eg, some might not keep the headers, while others might strip the reply token. As a baseline, we should test the eventual solution with Gmail, Outlook and Thunderbird.
Comment #3
ezra-g commentedI believe japerry is looking into this.
Comment #4
japerryTake a look at #1348912: Reply to comment in email for info on mailhandler and d6
After doing some research on mailhandler and og_mailinglist it appears mailhandler will be the easiest implimentation we can add for replying to comments in emails.
og_mailinglist isn't bad, but has a few issues for us:
mailhandler on the other hand, uses the feeds module, which requires a new CT. It'd be nice if there was a way we could hide that.
Also, while mailhandler has much finer control over how nodes and comments are posted, we would need to secure it so people cannot add their own keypairs (ie change node type, text format, etc) to change where email messages get posted in drupal.
For both methods, we need to add a way to authenticate the email. This probably is best done as a token embedded inside the mail header, as well as a line in the email. It needs to be user (maybe node?) specific so emails cannot be spoofed.
I'm leaning towards mailhandler right now, since requiring another 3rd party library feels DOA for me. We will need to implement a feature that sets up a feed and a default mailbox, probably during install.
Comment #5
ezra-g commentedThanks for this research.
I agree that between OG_Mailinglist and Mailhandler, Mailhandler seems preferable because it is more flexible and also not specific to OG.
I don't think a 3rd party library is necessarily DOA, but agree that we should be careful in vetting the health, overall quality (and licensing) of those libraries before including them.
It would be great to see the some additional information on how we might proceed with Mailhandler, such as:
- A screenshot of Mailhandler's default config page, to help give a sense of what its configurable options and default administrative presentation looks like.
- Some investigation into the specific approach (eg, what hook we'd use) to have Mailhandler add the proper information to the body and headers of emails sent from Commons' Message_notify based notification system, so that users can reply via email.
- An issue in the Mailhandler queue, even preliminarily, that proposes a more secure token (similar to the one-time login token) to help authenticate that content comes from an authorized user.
Comment #6
japerryHere is a screenshot of the main configuration page. This sets a default mailbox to recieve messages:
https://www.evernote.com/shard/s12/sh/c599ca07-f4b8-48bf-9a1f-fa2fa3a9fe...
We can change the default mailhandler feed so that it doesn't create a new content type to import mail. I think in our case, with comments, we only need one node -- therefore the standalone form will work fine:
https://www.evernote.com/shard/s12/sh/ae42108b-32df-42e0-b0c8-d725623cc9...
We will need to re-export a mailhandler feature, similar to mailhandler_default, found in mailhandler/modules
For authentication, the tokenauth module does some of what we want, but we'd have to dive into it to figure out if it does it all. What it does is provides tokens for users at a url path, and authenticates for that path, for that user only. We can adapt this module for mailhandler to provide a token for a user and node id to be sent out with an email using the built in tokens from tokenauth via the message notify feature. (since it uses tokens)
Comment #7
dustin@pi commentedSince this feature was in Commons 2.x, I've added this to the Meta issue: #1930406: [Meta] - As a site Administrator I would like to upgrade from 6.x-2.x to 7.x-3.? without losing functionality
Comment #8
lightsurge commentedIf I forwarded one of my notification's by email to another person, wouldn't that person then have all the data they needed to masquerade as me?
I may be missing something obvious here ;-)
Comment #9
japerryYes. Email is not a secure method of communication. Most mailing lists only use simple address verification, so if you can spoof someones email (easy), then you can send to the mailing list.
Looking at the tokenauth module, we can embed that in the 'from' header to the user, and so if they reply, it'll include the token. However, that user can also forward that token to someone else, and that person could masquerade as said user and post a comment on their behalf. Luckily, using tokenauth, damage is limited to one thread, and we suggest that people don't forward emails ;-)
In regards to our functionality, I think we want to only use it to respond to comments. I think there might be a way eventually to post nodes, but since we're looking at a 'tokenauth' based on a node, this wouldn't work for node creation (because the token doesn't exist yet)
Comment #10
japerrySome clarification on tokenauth, since it generates a token per user per message/node created, we just need to embed the token inside the message and re-export the feature.
On the receiving side, per the mailhandler_tokenauth module:
This should provide us the basic authentication needed to secure comment replies from random address spoofing, but doesn't really fix the problem of people forwarding emails to others, and then others malicously masquerading as the originator. Just have trustworthy friends ;-)
Comment #11
lightsurge commentedYes can see this being both the most useful and the most risky with the same groups of people in certain cases. Say a head of service posts their service strategy asking for comment, a valid criticism is received and notification sent, head of service forwards notification to larger workforce, and disgruntled technologically-savvy employee sees opportunity and posts 'my strategy is ****' from a near impossible to trace mta masquerading as the originator.
But so long as said head is well-briefed in these messages and not to forward them, it's actually really useful, because they might be more likely to interact.
So I'm on the fence I suppose, I'd probably disable it for all but those whom I'm confident properly understood the whole thing, but at the same time glad those who did understand could interact without having to take additional steps to do so.
Comment #12
japerryIn terms of security, replying to comments via E-mail is no different than a mailing list, which has inherent security issues. There is really no way to use email in a full-proof secure fashion, since the from address can be spoofed and the token (password) can be mistakenly shared.
The ways to mitigate this is by having the token in the drupal reply-to, and requiring this token when you reply to an email. For most people, this allows you to hit reply to keep talking in the comment thread.
But either way, reply via email can be disabled if admins don't want to use it like a mailing list.
Comment #13
japerrySo most of the components exist to make this feature work. The major work we will need to do is alter the message functionality inside commons_notify to change the from message to use tokens.
Probably not more than 4 or 5 days with testing.
Comment #14
mrfelton commentedBeen playing with this most of the weekend. I have something that works pretty well with my limited testing. It uses mailhandler, mailcomment & mailhandler_singlemailbox. I have included a make file that details all of the modules and patches that are required.
After enabling, you'll need to enter your mailhander mailbox credentials, and your mailbox will need to be should be set up as a catch all. This allows you to, for example, send to groupname@example.com to post content directly into the group called Groupname. It also enables replying to notifications via email to have those added as comments on the relevant post.
Comment #15
danepowell commentedThanks @mrfelton, I'm working on integrating part of #14 (Mail Comment / Message integration) into the Mail Comment module at #1730706: Basic integration with Message Notify. Also, as the maintainer of Mailhandler / Mail Comment, let me know if you have any questions. I don't have time to actively monitor discussions but will respond if you contact me directly.
Comment #16
behoppe333 commentedHi. Thanks everyone for your work -- I am very interested in this.
I guess from the title of this thread that we're integrating email with comments, which is great for every commons content type except Q&A.
Does anyone have a sense of the likelihood or ETA for integrating email with Commons Q&A? I mean that when you are notified of a question, you can reply by email and that creates an answer to the question on the site.
My users really want to respond by email, and the thing they most want to respond to are Commons Questions...
Thanks
Comment #17
meba commentedFor Commons, Mailhandler is one possibility but I would personally like this as a pluggable architecture so if you want to use Mailhandler, do it but you can use other tools such as Mailgun.
For a MVP, I would choose Mailgun.net as a solution since Mailhandler and parsing email is just a pain while with Mailgun we could outsource parsing of emails, their receival and everything else and then receive all the emails via an API.
Comment #18
robertgarrigos commentedTrying to use mail comment with commons with no luck when I found this threat. Any update on this?
Comment #19
danepowell commented@robertgarrigos: I'm not working on integration with Commons, only with Message Notify, which theoretically should allow Mail Comment to work with Commons. I'm afraid I can't provide support on integration, as I've never even installed Commons before.
Comment #20
robertgarrigos commentedThanks Dane.
In any case, this is a commons issue, so can I make it work? The problem now is that some of the commons message types cannot be used with mailcomment because their form_id's name is not "message_type_form". Cloning the message type doesn't work either. Is there a way to have those message types work with mailcomment?
Comment #21
robertgarrigos commentedright, found a way, although I had to hack the code of mailcomment. Hope Dane could implement it someway (and better). This is what I've done (sorry for not posting a patch, I really think this can be very improved):
On mailcommnet_message_notify.module file:
change this three lines in mailcomment_message_notify_form_alter() function:
with this:
Then the module needs to read the message entity to insert the "reply above..." line. This is done by looking for a "field_comment_ref" or "field_node_ref" fields. Although I created those fields, for some reason the module doesn't find them. So, I changed the module's code to use the reference fields created by the commons feature for the message types it uses to send messages for new node and comments (commons_notify_comment_created and commons_notify_node_created). I've done this by cloning and changing the code within the mailcomment_message_notify_mail_alter() function in the same file.
The code I clone is:
Then I added the elseif clauses to match the right commons reference field, which are field_target_comments and field_target_nodes. So, this is how it goes:
As I said, I'm sure Dane could find a more elegant solution to adapt the code to the commons message types, but this works right now for me.
Comment #22
danepowell commentedI opened up an issue in the Mail Comment queue: #2156655: Improve Message Notify integration
However, I'm afraid I don't have time to work on this at the moment.