Closed (won't fix)
Project:
Mailhandler
Version:
master
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Sep 2004 at 01:36 UTC
Updated:
2 Apr 2011 at 05:43 UTC
Jump to comment: Most recent file
Comments
Comment #1
javanaut commentedAdd mailhandler_set_message($msg) and mailhandler_set_error($errmsg) functions.
mailhandler_set_message($msg) would append a message to a global array of messages to be returned to the sender if user preference is set to do so. Message would be formated as a status message and list all actions taken (listing urls to new nodes created, for example). The purpose of this is to indicate to the user when the message was accepted and processed.
On the user profile page, there could be a checkbox indicating that these status messages should be sent and an optional alternate email address to send them to.
The mailhandler_set_error function would be setup basically the same way, but the message format would indicate that an error occurred while processing email. The status message could be prepended to the error message as well if the mail was partially processed, but not completely. This should give the user some indication of what follow-up action to take, if any, or what file types are not accepted, etc..
An example of a mixed error/status message would be if a user sent in multiple files in a single email, and one was of a type not accepted, then a message would be returned detailing the success and failure of processing each attachment of the email.
Comment #2
moshe weitzman commentedI would support a patch like this ... As for what language to use in the messages, listservs let you send multiple commands and receive multiple responses. They are a good model. See mailman, Listserv )http://www.lsoft.com/info/default.asp?item=manuals), etc.
Comment #3
javanaut commentedI've implemented a tentative patch for this. I have not thoroughly tested it, so I'm hesitant to even throw it out here, but I might not have time to work on it tomorrow.
I coded it against version 4.5.0, so I'm changing the version of this request to 4.5.0. I will need to update the cvs version of mailhandler with this once it's accepted.
Comment #4
moshe weitzman commenteda quick read through looks good ...
could we not use the standard drupal_set_message() and then finally retrieve with drupal_get_message()? these functions already have a $type param for positive or error messages.
Should the following messages use watchdog in addition? they will usually happen during a cron run: - drupal_set_message("Sending error email to sender $fromaddress");
we usually submit patches in 'diff -u' format.
Comment #5
javanaut commentedI considered using drupal_set_message for this. In fact, I modeled my solution around it. I had two issues with using it:
1. It uses sessions, which I think would be unnecessary overhead for these messages. The lifespan of the set of messages is the time it takes to process a single mail message. On a server that sends session data to the database and has a large mailbox to read, this could greatly slow things down.
2. I don't want to pollute the regular webpage-bound messages with content that's being sent to email recipients. I couldn't see an easy way around this, as drupal_get_messages grabs and displays all content while clearing out the array for the next request. I considered creating and removing the appropriate sub arrays within drupal_set_message's data structure, but if ever the implementation changed, I'd be screwed. Also, any pass-by-reference instances have their own set of issues.
Oops..that was meant for debugging purposes, but I guess it might be a good thing for site monitoring. We should probably discuss all of the messaging here and determine the current validity of it all as well as where it should go and when. I tend to prefer excess information, but I know it can be difficult to see real issues when there's so much data. I would like help figuring out what real users would prefer.
I just happened to be looking at the page in the Drupal handbook on contributing patches, and the -F^f option was mentioned there. I didn't know who, if any, prefers that format over the -u option. I think I like the -u option better, too.
There are a few lingering issues, like what controls how/when return mails are sent? Do we prefer the user preference or the mailhandler setting (or use the user preference conditionally based on the mailhandler setting)? I didn't alter the existing code where responses were sent. Would it make sense to merge both of these pieces of logic?
Also, should there be a limit to keep mailhandler from going off the deep end and sending 10Mb of error messages?
Also missing is the alternate return mail address. I still need to add this.
I rearranged the hook_user in addition to my changes. The version I started with didn't seem to be functional with 4.5.
Comment #6
Uwe Hermann commentedYou can easily combine both options:
HTH, Uwe.
Comment #7
javanaut commenteddiff -u version of same patch
Comment #8
javanaut commentedThe thought occurred to me that error/info messages could be constructed such that if the user replies, that their reply could be associated with the original post in the form of a comment or perhaps other information. This might qualify as a separate feature request, but I would suspect that just sending some form of reference to the original post (such as a $node->nid or $comment->cid) could be used in the reply to determine what to do with it (post comment for example).
This would be useful for mobile users who can only send text or binary, but not both. They could create a node full of binaries, get a reply message from the server, then reply to that to add a comment or append to/change a node body. Additionally, a comment hook could be configured to email the user all comments posted to a mailhandler-submitted node (again, separate feature request, I'm sure).
Does this sound like a practical feature, or am I just dreaming up busy work for myself? Moshe, I could see this taking on the form of the list handler syntax that you originally suggested. Are X-headers sent when a message is replied to? I'll test this out.
Comment #9
moshe weitzman commentedthe only headers that get sent back upon reply are in-reply-to and/or references. mailhandler already parses these headers and adds them to the $node object which is handed to hook_mailhandler. you can encode as much info as you wish ni thesde headers. see listhandler.module for example usage.
it seens to me that not many moblog users would be happy with a 2 step solution where they mailed binaries and then mailed text (or vice versa). the second interaction makes it just too annoying IMO. thats the whole reason we are avoiding authentication via a confirm email.
Comment #10
javanaut commentedThe main use case that I would want to offer is for users to be able to post comments to the nodes that they just created. I suppose I could configure some in-reply-to headers to point their reply back to the just-posted node. Since multiple nodes could be created from a single email, does it make sense to send multiple response emails for this purpose? Maybe mailhandler_set_message should be configurable to accommodate this by specifying what node to associate what messages with. This would only work for messages generated after the node was created.
I would say, definitely, that a 2-step process for the initial post would be too painful for most mobloggers. However, if a user is at an event (away from computer) and posts content, I would like for them to have some facility for adding follow-up comments to that node, as well as being able to respond to comments that are posted to the node. Editing node properties of an existing node would probably not be very useful.
Do you know if a module exists already that sends email when a comment is posted to a node? If so, does it allow a user to reply to the comment via email? I know mailhandler handles comment posting, but I don't think it currently handles sending comments to an email address. Am I correct, and does that sound useful to you?
I sometimes wonder if I'm not unnecessrily adding complication to the problem, which is why I solicit your opinions. Does any of this seem useful to you?
Comment #11
moshe weitzman commentedyou really ought to see listhandler.module. it 'mail enables' a forum. in other words, it send out nodes and comments via email, and accepts replies to those emails via email. it uses mail headers to figure out which incoming replies belong to which threads.
i don't see a use case for posting comments to an existing node in the context of moblogging. a few people might use it, but its rare. i'm not a moblogger though, so i don't know that for sure. so for this specific case, i think the complication is not worth it.
Comment #12
javanaut commentedOk, I suppose determining how and when to send an email may be up to the individual module. I guess I was confused by the fact that mailhandler accepts nodes and comments via email, but does not send any emails that have headers compatible with mailhandler_process_message()'s logic.
I grepped through the contributions directory and found that: listhandler and project both use mailhandler, as well as several sandboxed modules.
After browsing through some of these modules, I can see how to construct an email so that it's reply should be associated with a particular node or comment (at least, in theory). I've started writing some code to handle this, but I've placed it within the moblog module.
Comment #13
javanaut commentedOk, more code!
Here's a patch against current CVS mailhandler.module that adds the following:
* mailhandler_perm: 'post by mail' permission: this is now wrapped around the calls to hook_mailhandler
* mailhandler_switch_user now returns the user being switched to (used for user_access() call)
* mailhandler_set_message: sets 'error' or 'info' messages for later processing
* mailhandler_get_messages: gets messages for processing
* mailhandler_email_response: If there are any messages and user pref allows, email is sent
* mailhandler_user: updated to work with d4.5, added 'send errors', 'send info' checkboxes and 'alternate reply email address' textfield to user prefs
* mailhandler_settings: added settings hook to allow admin to specify email/info email subject/titles.
Things that it doesn't have and (IMO) are beyond the scope of this feature:
* changing all calls to user_email to instead use the mailhandler_set_message functionality
* any intensively researched security changes due to the mailhandler_perm addition
* a means of formatting the error/info message bodies that involves all possible variables. Maybe some other day.
Please try this out when you get a chance. I don't think I've broken anything, but that's a common attitude among developers ;) I've implemented all of the major parts required to finish this feature, so all I suspect is left are bug fixes. I'm very curious to see how, if at all, this affects other mailhandler modules (listhandler, project).
If any further modifications are made to existing user_mail calls, I'd prefer them to be a separate feature, as this patch is already very big.
Comment #14
javanaut commentedAhem, now in unified diff format..
Comment #15
moshe weitzman commentedYou may go ahead and commit. If its broken, someone will surely scream.
some day soon it would be nice to enhance drupal_set_messages() so it could be repurposed for our needs. I hate duplicating functions from core. also, the added prefs on the user profile page are a bit of an eyesore. perhaps we can add a pref where admin can prevent those from displaying.
Comment #16
javanaut commentedAs far as enhancements to drupal_set_messages(), I would think that the cpu overhead of using sessions would be negligible compared to the pain of duplicating code. What would help would be able to pass an argument to drupal_get_messages($type=NULL) that, if specified, would return and clear just the messages of the specified type.
Maybe user mail options should go under their own user profile tab? I could see mailhandler, mailalias and others being grouped together like this. Which of the options do you think should be optional? I agree that it is cluttered looking. Maybe an "advanced" tab for more options?
Are you OK with the mailhandler_settings page (admin/settings/mailhandler) being separate from the mailbox management page (admin/mailhandler)? Should these be on the same page (but separate tabs), or do you think anyone would care?
Comment #17
moshe weitzman commentedsounds good. please do submit a patch for drupal_set_messages() accordingly. in the meanehile, we can duplicate code.
i think i like an 'email' tab on the user profile. better than the advanced tab.
i'm ok either way with the admin settings page.
Comment #18
cor3huis commentedBump, looks like good feature request to me. Unassigned the issue otherwise no-one will look at it I bet.
Comment #19
ilo commentedI can foresee a lot of problems because of this issue ;)
User A would like to, submits 3 files, one of them is rejected, post goes ahead with a missing file, he does not want a message back about the error.
User B would like to, submits 3 files, one of them is rejected, DO NOT post because of a missing file. He wants to know what exactly happend.
All this fall into the 'site configuration', and not in the module space, because I'm starting to see a lot of 'add a checkbox for this functionality' issues. In the meantime, lets admit it, still there is no any kind of 'detailed information' to return back. E.g. what should be returned if the user is authorized to publish content but not to upload files? Where does the message come from I mean.. Where can the user disable this type of notifications?
This does not only affect Mailhandler, but also other modules making use of hook_mailhandler. What if another module performs an action and wants to include notifications to the user? where are they reported back to mailhandler to be included in this reply message? what if we get double notifications because of module A and module B informing the user about the error X?
As a very basic, Mailhandler manages the email submissions, but does not replace the Drupal web interface, so I'd say, it is a great improvement, but requires a lot of thinking in the meantime.
Cor3huis, do you mind if we postpone it for a while?
Comment #20
cor3huis commentedYes, postpone is just fine. Reading the issue again, while "theoretically" nice to have, I cannot see this as real benefit that will add a real strong value to the users experience chain.
Comment #21
ilo commentedok, thanks :)
Comment #22
cor3huis commentedComment #23
danepowell commentedCool as it sounds, realistically, I don't think this is going to happen unless there is really strong interest in it (which there doesn't seem to be).