php-imap-client icon indicating copy to clipboard operation
php-imap-client copied to clipboard

Inline images come as attachment

Open abdullahseba opened this issue 8 years ago • 10 comments

Hi if an email has inline images they load as an attachment and wont show in the html at all. Note the errors from them too. image

abdullahseba avatar Jun 03 '17 18:06 abdullahseba

#dead?

abdullahseba avatar Jun 16 '17 18:06 abdullahseba

Hi sorry ive been inactive. Ill look into this

mattparksjr avatar Jun 19 '17 00:06 mattparksjr

Never mind :)

abdullahseba avatar Jun 19 '17 00:06 abdullahseba

Was it a mistake on your end?

mattparksjr avatar Jun 19 '17 00:06 mattparksjr

No, the HTML has no images at all. it just comes as an attachment

public function getMessages($request, $response, $args)
  {
    $imap = $this->ci->imap;
    //Get request data from POST.
    $params = $request->getParsedBody();
    //Select mailbox
    $imap->selectFolder($this->getMailboxName($mailbox = $params['currentMailbox']));
    //Get and encode email.
    $messages = array();
    foreach ($params['ids'] as $uid) {
      $id = $imap->getId($uid);
      $email = $imap->getMessage($id);
      $attachments = array();
      foreach ($email->attachments as $attachment ) {
        $attachments[] =   $attachment->name;
      };

      $emailConstruct = array(
        "subject" => $imap->convertToUtf8($email->header->subject),
        "from" => $imap->convertToUtf8($email->header->from),
        "udate" => $email->header->udate,
        "body" => $imap->convertToUtf8($email->message->html->body),
        "attachments" => $attachments
      );
        $path = $this->ci->locator->findResource('sprinkles://webmail/temp/attachments', true, true);
        $imap->saveAttachments(['dir'=>$path]);
         $messages[$uid] = $emailConstruct;
    }
    //Return email.
    return  json_encode($messages);
  }

Than I download the attachments separately for the preview.

abdullahseba avatar Jun 19 '17 02:06 abdullahseba

Thank you for working around this. We will fix this soon.

mattparksjr avatar Aug 03 '17 21:08 mattparksjr

@sergey144010 ping

mattparksjr avatar Aug 30 '17 18:08 mattparksjr

i don't know how to decode all of this code can you help for decode all this code & abdullahseba xXXIMMATTHEWXXx if you have any full code then please inform me or give me some tutorial video or website

deepak458 avatar Jan 15 '18 10:01 deepak458

I dont know what you mean by full code. Our code is available in the repo though.

mattparksjr avatar Jan 16 '18 22:01 mattparksjr

Hello,

Thanks for your reply. I'm a little confused how I use your code to get my emails. Can I use it json or use it on page code.

And when I want to show my mail subject out of foreach it's show only one.

If you have any idea how I can use with Ajax or json then please suggest me.

And how I set set value when someone open mail then mark as read and how to search work.

And how I check its have any attachments then it's show Yes otherwise it's show No. If you have some time then men please help me out.

Thanks Deepak Saini

On Jan 17, 2018 4:26 AM, "Matthew Parks" [email protected] wrote:

I dont know what you mean by full code. Our code is available in the repo though.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SSilence/php-imap-client/issues/175#issuecomment-358135696, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab5MVnGfz-irRa8iZ8Q_BkfogLAimIv7ks5tLSkGgaJpZM4NvKzR .

deepak458 avatar Jan 17 '18 04:01 deepak458