Mailsave is a module that is designed to interact with mailhandler. It will detach files that are emailed to the site and save them with the node. It can also interact with other modules such as image, to provide functions like automatic conversion of nodes to image nodes. This can be used to allow posting of pictures from devices like mobile phones.

Mailsave for Drupal 6 released

The first official version of mailsave for Drupal 6 has been released, but at the moment it only includes the main mailsave module (the part that saves attachments) and the clean up filters.

The main extension module - mailsave_to_image - can't be released officially since the accompanying image module is only at alpha so is not yet fully stable. However, mailsave_to_image for Drupal 6 is available from HEAD and works with the current (alpha 2) release of image, so feel free to try it out.

Extending mailsave

Since version 5.2 mailsave on its own does nothing other than saving attachments. However, it can call other modules via hook_mailsave. It sends all the attachments to the called modules so the other modules can implement whatever functions they like. This way it is possible to write custom modules to react to incoming attachments, e.g. by changing the node type, while mailsave can look after the actual process of saving the files. The idea of this is to make it much easier for other people to write extensions for mailsave without having to re-write the mailsave code itself.

Version 2 also introduced a new feature in the form of hook_mailsave_clean. This is designed to provide some advanced clean-up of messages, primarily those that are sent via mobile network MMS gateway. These emails typically contain additional text and images that are added by the gateway. This additional text may at best result in a lot of junk information, and at worst may reveal your phone number. hook_mailsave_clean allows the message to be processed via regex and can manipulate the node as required. An example always helps, so here are links to an MMS message showing how it appears before and after processing through a clean-up filter.

Although filters are standard PHP/Drupal code they aren't "true" modules in the sense that they are written as .inc files, not .module files. To activate them go to Administer > Site configuration > Mailsave once you have installed mailsave. You can use the examples to develop your own filters, or alternatively you can contribute a sample message and I will use it as a template to develop new ones. More details in this thread.

Mailsave respects the upload privileges of the submitting user so the allowable extensions and filesize limits that apply to uploads also apply to email submissions.

Documentation

I'm afraid that at the moment this should be titled "No documentation" as I haven't got round to writing any yet! However, there is a brief overview of using mailsave with a CCK image field on Ventura cottage. Using mailsave with other extensions like mailsave to image_attach work in much the same way.

Project Information

  • Maintenance status: Unknown
  • Development status: Unknown
  • Module categories: Content, Mail
  • Reported installs: 180 sites currently report using this module. View usage statistics.
  • Downloads: 6,476
  • Last modified: December 7, 2009

Downloads