Forums | Mahara Community
Developers
/
emailing the whole message
31 October 2013, 6:56
Hello,
My boss wants me to make our mahoodle send out the whole message when two mahara friends message each other via email, mahara only sends an email notification with a link.
Is there a setting that does this, and if not, does anyone have some hints or tips about how I could get started programming this functionality? Theorheticaly it doesn't seem like it would be that hard, but that's what I always say and then it ends up being trickier than I thought.
31 October 2013, 15:12
Hi Dave,
There is not a setting for that, but I can direct you to how to code it. There are two things you need to know about:
1. Activities: These are the things that cause Mahara to send out messages. The Activity-related code is in htdocs/lib/activity.php . User messages are an ActivityTypeUsermessage, as defined in that file. Mahara plugins can also define their own Activity types to extend this.
2. Notification Plugins: This is a Mahara plugin type for sending notifications to users. The code for these is located under htdocs/notification. There are three notification plugins that come with Mahara: email, emaildigest, and internal, each of which represents a separate way of sending messages to users.
Each user has a notification settings page that lets them select which type of Notification they want to receive for each Activity.
Anyway, the code that makes it so that user message aren't printed in emails is in the "email" notification type -- in htdocs/notification/email/lib.php, on line 61 (in Mahara 1.8 that's the line anyway). The code actually has a comment explaining why: "Do not include the message body in user messages when they are sent by email because it encourages people to reply to the email."
It'd be a simple matter to comment out a few lines of code and make it always send the notification message. If you want to write something that could be upstreamed back into Mahara core... perhaps an optional config setting that determines whether user message bodies get emailed? (Or, ideally, it'd be great to see an extension that allows messages to be replied to by email, but that would be a bit of an undertaking)
Cheers,
Aaron
02 November 2013, 6:28
Thanks! I'm looking into it. I agree that replying by email would be a bit of an undertaking... I think you'd basically have to create a system that allows for email address creation inside of mahara. Like facebook kind of does.
I also agree that theorhetically it's probably best to encourage people to log in, but since we're a mahoodle we direct the moodle messages through mahara and the moodle messages and forum posts, and other things do have messages, so to our end users it doesn't really quite make sense why their personal messages don't.
Thanks again,
Dave
11 November 2013, 15:27
I'd love to see a plugin for responding to Mahara user messages and forum posts by email. :)
There are other web applications out there that offer this functionality. Launchpad, for instance. Moodle has been discussing it forever, but hasn't actually done it yet (or we probably would have just ported over their solution) https://tracker.moodle.org/browse/MDL-3714
I haven't looked into the details of it, but as long as you're only using it for replies, you don't actually need to create separate secret email addresses for each user. Launchpad seems to use the Message-Id email header as the identifier to determine your identity and which thread you're responding to. With that system, you just need to have Mahara periodically poll the "replyto" address, check for new messages, and then put them in the right place via the Message-Id.
Cheers,
Aaron
21 November 2013, 17:22
I was looking through the code for unrelated reasons today and noticed that Mahara already has a system to handle bounced messages by VERP, either by polling an IMAP mailbox or by having the message piped to a PHP script: https://wiki.mahara.org/index.php/Developer_Area/Specifications_in_Development/VERP_Mail_Bounces
So, that takes care of some of the necessary groundwork for responding to the forum or private messages by email.
Cheers,
Aaron
22 November 2013, 4:48
Andrew Nicols wrote a specification for email processing in the past, here it is: https://wiki.mahara.org/index.php/Developer_Area/Specifications_in_Development/Email_to_Journal