This issue is for D7 only and it is a similar issue as this one for D6 : Support for inline content (e.g. images)

So I tested the patch for D7 suggested in that other issue for the feeds module in comment #9 along with version 7.x.29 of Mailhandler and the images are still published with the path : public://mailhandler_temp/imagename.png

As suggested by the Feeds module maintainer, I used the module Feeds Tamper to do a simple Find & Replace on the mail feed importer. You search for public:// and replace it with whatever is your full path to your image and that does the trick!

Maybe this could be fixed another way in the mailhandler module or elsewhere but this workaround is a good enough solution for my current needs. I thought it would be a good idea to share...

And thank you very much for a great module, Mailhandler does magic! :-)

CommentFileSizeAuthor
#2 inline-images-d7-2228401-2.patch2.06 KBLeDucDuBleuet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LeDucDuBleuet’s picture

Ha Ha! I just realised my workaround only fixes the problem temporarily since files in /mailhandler_temp/ are managed by Drupal and deleted automatically after DRUPAL_MAXIMUM_TEMP_FILE_AGE elapses as stated in Attachment temp files, are they to be temporary?. So after a while, we end up with broken images in nodes created by mailhandler. There really is a bug somewhere because it does not make sense that these images stay in that temp folder...

Also, I wonder where and when these files should be moved to a permanent location? Should it be the Feeds module's job to look into the node html body in order to detect the "public://" files and move them somewhere else? Is so, where? I have looked in the code and the feeds node processor does not seem to touch at all the content of the node body. That is why I think maybe it should be done in Mailhandler -> MailhandlerCommands -> process function. I am working on a little patch to illustrate better what I mean...

LeDucDuBleuet’s picture

Status: Active » Needs review
FileSize
2.06 KB

Here is my take on a patch for this bug, it may not be perfect and it could have been coded in many other ways...
It simply saves inline images in the arbitrary folder "/mailhandler/" and does not set them to be deleted automatically. It also replaces "public:/" with the actual path for the file in the body_html.
I've tested this solution on the current 7.29 and DEV with success, your mileage may vary.
Thank you.

Status: Needs review » Needs work

The last submitted patch, 2: inline-images-d7-2228401-2.patch, failed testing.

LeDucDuBleuet’s picture

Version: 7.x-2.9 » 7.x-2.x-dev
LeDucDuBleuet’s picture

Status: Needs work » Needs review
shevgeny’s picture

Notifies an error in line 33 by using private file system, which is logical, because you just point to a public file system, but it is not entirely correct.

Notice: Undefined variable: filename in MailhandlerCommandsFiles->process() (line 33 in ...sites/all/modules/mailhandler/plugins/mailhandler/commands/MailhandlerCommandsFiles.class.php)

shevgeny’s picture

It does not work. Some error in line

$file = file_save_data($attachment->data, $destination . $filename);