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

replaceInternalLinks() return empty string

Open pandisoft opened this issue 4 years ago • 3 comments

  • PHP IMAP version: 4.1
  • PHP Version: 7.4
  • Type of execution: Web server

I tried to get html content with with internal links using replaceInternalLinks() method, but it always return an empty string. (the email html was fetched perfectly ) https://github.com/barbushin/php-imap/blob/7ca3d19451bfe6de47186b52f4b266179a5858b9/src/PhpImap/IncomingMail.php#L182

When i changed the source code from $fetchedHtml = $this->textHtml; To (string) $this->__get('textHtml');

it worked fine!! is this a bug or i missed something!!

pandisoft avatar Feb 05 '21 11:02 pandisoft

Can you please show us your relevant code, so that we can see what you are trying to do?

Sebbo94BY avatar Feb 23 '21 20:02 Sebbo94BY

Can you please show us your relevant code, so that we can see what you are trying to do?

I was trying to save the email on database, i had to change the inline attachment URI so it appear correctly to the user

      // ......
      // Load eventual attachment into attachments directory
        if( ! $this->load_attachments){
            $mailbox->setAttachmentsIgnore(true);
        }

         // Replace inline attachments links
         // Here replaceInternalLinks returns empty string
         // When i changed the source code, it works fine
         // See my post above
        $contentHtml = $mail->replaceInternalLinks($attachdir);
        $contentHtml = mb_convert_encoding($contentHtml, 'UTF-8');
        
        $inbox = new MailInbox();

        $inbox->content_html = $contentHtml;
        //.....

pandisoft avatar Mar 01 '21 10:03 pandisoft

Can you still reproduce this issue with the release 4.3.0?

Sebbo94BY avatar Dec 28 '21 00:12 Sebbo94BY