Where can I use Mailhandler?

Submitted by Milos on Wed, 08/10/2016 - 19:01

Where can I use Mailhandler?

This year’s Google Summer of Code is slowly coming to an end. I am working on latest steps to complete the project as planned. In the previous blog post, I was writing about the final code polishing of Mailhandler, while the focus of last week (#11) was to improve the overall project documentation. Before the project wrap-up blog post, I am going to write about the real use-cases for Mailhandler.

5 steps to create secured user-content-driven Drupal website

One of the best use-cases for Mailhandler would be for media publishing Drupal-based websites. Those websites usually have different user roles for content creators, publishers, editors, administrators… That means a very different set of permissions for each role. For instance, one website could allow its users to create site content. Users could submit it either through a website or by sending a signed email using Mailhandler.

In order to enable users to create content by sending an email, an administrator would need to follow these simple 5 steps:

  1. Enable authenticated users to post nodes for a specific content type (e.g. Users posts).

  2. Set-up an email address that users will send content to.

  3. Enable Mailhandler module and make sure gnu_pg PHP extension is enabled on the web server.

  4. Create a new deliverer in Inmail to fetch new emails. This can be done by using an IMAP deliverer.

  5. Set a content type in the (MailhandlerNode) handler configuration that will be used to create content in.

By completing all the steps, a Drupal website is ready to accept users submissions. Since we are going to use PGP-signed emails which add an additional layer of security, the following steps are needed on the user side:

  1. Log in to the account and update your GPG public key. PGP-signed messages are signed with a private key of a user and verified on the Drupal website with the corresponding public key. PGP method of authentication is briefly explained in this blog post.

  2. The email address in the user account needs to match to the address user wants to send emails from.

  3. The subject needs to begin with [node] part. This is a technical term and tells our plugins about the referenced entity type.

  4. The final step is to write your article and send the email!

Voila! The user created content is available on the website. Since it was digitally signed, it is guaranteed the message was not changed in transmission and the user can not deny sending and signing the message.

Some web hosting services don’t support gnu_pg PHP extension by default. However, you can still benefit from Mailhandler by using a less secure From email address method of user identification. In order to use it, you will need to enable Message Sender Analyzer.

The above use-case represents one part of the Mailhandler features. The module can be used in a similar way to post comments via email, create ads or to make any other email integration with “node” entities out-of-the-box.

To allow end-users and developers an easy start with the module, we have been improving project documentation a lot. A Github pull request has been submitted and passed for the review to my mentors. All Inmail analyzers and handler plugins provided by Mailhandler will be documented and described in details. Also, the project will get a ReadMe.MD file that will consist of the module description, installation, configuration and how-to sections.

Also, I would like to inform you that lead maintainer of the Mailhandler, Dane Powell recognized the efforts we made this summer and gave us write access to the original repository. Thanks to him, we will be able to merge our Github repository and a sandbox project to the main module. This is one step forward to releasing a stable version of Mailhandler and a duty to keep contributing to Mailhandler in the future too.

The plan for the following week is to merge the documentation pull request and work on remaining Inmail issues that we started earlier. Additionally, the final project evaluation starts in less than a week and I will spend some time to prepare for it as well.

Drupal 8 module demo: Mailhandler from Milos Bovan on Vimeo.