Hi

I'm using mail handler to pick up emails. I would like to put these images into a users node gallery. Is this possible? and could anyone offer any guidance it would be greatly appreciated :)

The image is extracted just fine. The gallery image content type is field_node_gallery_image but following the retrieve the node is created but the type is set to 'Image'.

Many thanks

Comments

artistapps’s picture

Can anyone assist? really hit a road block with this

ajeancharles’s picture

I made some changes to Mailhandler module so that when you assign it's default type to "Image" and you send it an image,
it looks at the mime parts for a jpeg (other drupal image mime types could be added) and if a jpg is found, it creates and image using the attachment/mime part using image api as below, before that the image would not have the image field filled out in the Image Type, as most you can have an attachment.


// in mailhandler module
function mailhandler_node_process_message($header, $origbody, $mailbox, $mimeparts)
  .......

// after the authenticate message block
 if( $node->type == "image" )
 {
    foreach ( $mimeparts as $parts )
   {
      // print($parts->filemime) ;
     if (($parts->filename !== 'unnamed_attachment') && ( $parts->filemime == "IMAGE/JPEG"  ) ) // I can add additional ones
    {
        //modified by LLE
        $cleanfilename = mb_decode_mimeheader($parts->filename);
        $file = file_save_data($parts->data, file_directory_temp() . '/' . $cleanfilename);
        $node->images[IMAGE_ORIGINAL] = $file ;
        image_insert($node) ;
     }

  }
 }

.............

I would like to submit my changes to be part of the module.

ajeancharles’s picture

I put some comment on July 7, 2011 at 1:03am did it help you?