Mailsave hasn't been updated since August 20, 2008, and there is an issue in the queue indicating it hasn't worked with Drupal since 6.16 (see: #741468: This version is incompatible with the 6.x version of Drupal core.).

Moreover, Mailsave is incompatibile with the next version of Mailhandler, 6.x-2.x.

Are there any plans to support this module in the future, or is it abandoned?

Note, this as an official inquiry of maintainership.

Comments

mfb’s picture

I am maintaining the module. Just realized I was not subscribed to the issue queue since I got maintainership of the module so unfortunately haven't seen some of the recent issues until now!

I recently released an alpha version of a Drupal distribution (install profile) that uses mailsave so I do plan to devote some time to getting patches committed. Would definitely appreciate help from anyone else using the module and will now be paying attention to the queue.

mark trapp’s picture

Great to hear!

I was interested because I'm trying to get attachments from messages using Mailhandler 2.x. I spent the morning working on it, and I'm pretty close to having a working module for at least a subset of Mailsave's functionality (namely, saving attachments to a FileField/ImageField). I'd be happy to contribute my code once complete. The changes from Mailhandler 1.x to 2.x are pretty drastic, and it appears the functionality that was in Mailsave can be done in a fraction of the code.

mfb’s picture

I am not yet using Mailhandler 2.x since it looked like there was no upgrade path for existing sites. But, sounds like your code should go in a 6.x-2.x branch of mailsave.

mark trapp’s picture

After spending some more time with it, I think the attachment saving functionality should just be a part of Mailhandler itself: Feeds does 95% of all the heavy lifting now; the only thing Mailhandler needs to do is save the files to a temp directory.

I created a patch for Mailhandler here: #927014: Provide e-mail attachments as FeedEnclosure objects to support FileField mappings

I didn't touch the cleaning filters; perhaps that could be the basis for a Mailsave 2.x that interacts with Mailhandler 2.x should the changes I proposed to Mailhandler get committed.

mfb’s picture

OK I'm tracking that issue. This sounds pretty exciting.

We've found that receiving attachments from e-mail is quite complex. Messages from mobile carriers' MMS-to-e-mail gateways can have a jumble of HTML, plain text, SMIL, image, audio and video MIME parts. For example, a caption for a media attachment will be appended as a text attachment. Filters need access to the MIME structure of the email to get the media files and any metadata such as captions. There are various issues with the messages to work-around such as media attachments missing file names or missing file name extensions, and text attachments missing a character set.

So, as long as the Mailsave 2.x filters have access to and fine-grained control over Mailhandler's processing of attachments, we should be able to go in this direction.

mark trapp’s picture

Title: Is Mailsave still being maintained? » Port Mailsave to Mailhandler 2.x
Component: Miscellaneous » Code
Category: support » task

Mailhandler 2.x, as it is now, maintains those abilities: all MIME parts are stored in $object->mimeparts more-or-less untouched (Mailhandler decodes the data using imap_base64, quoted_printable_decode(), and imap_utf8 before saving to $object->mimeparts).

In fact, the patch I provided relies on that to identify MIME parts that have file names. My patch creates a new property and leaves the original mimeparts property untouched so other modules can act on it.

I had to clean up e-mail HTML tonight for a project I'm working on so I could convert messages to Markdown, and I was able to do it successfully with hook_feeds_after_parse(). This is what I used; it should work as a template for any cleanup module:

 function test_feeds_after_parse(FeedsImporter $importer, FeedsSource $source) {
  // Figure out the mimetype of the body
  $fetched = $source->batch->getRaw();
  $mime = explode(',', $fetched['mailbox']->mime);
  
  // We only want to convert HTML e-mails.
  if ($mime[0] === 'TEXT/HTML') {
    $messages = array();

    // Remove each message from the batch and act on them
    while ($item = $source->batch->shiftItem()) {
      // Act on the original body.
      if ($item['origbody']) {
        $item['origbody'] = _test_cleanup($item['origbody']);
        $item['origbody'] = _test_html_to_markdown($item['origbody']);
      }
      
      $messages[] = $item;
    }
  }
  
  // Add the modified messages back to the batch.
  $source->batch->setItems($messages);
}

If you wanted to act on the MIME parts, you'd modify $item['mimeparts'] instead.

ilo’s picture

Please, whatever the plans to support mailhandler 2.x branch, use mailsave 2.x branch. I'm currently performing some 1.x cleanups and improvements, including the attachments part. I'll provide patches for the 1.x branch to keep the code updated so it works with newer versions of mailhandler 1.x.

Note: mailhandler 2.x is not the next version of mailhandler 1.x, this is a different solution using feeds module.

thechraveler’s picture

subscribe

danepowell’s picture

Hi, I am the maintainer of Mailhandler 6.x-2.x and 7.x-2.x. Attachments are handled natively by Mailhandler 2.x, so I don't really see the need for an updated version of Mailsave for the 2.x branches. Is there something I'm missing, or can this issue be closed?

mustanggb’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)