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

Email with attachments result in error.

Open abdullahseba opened this issue 8 years ago • 43 comments

Hi $emails = $imap->getMessages(); results in

[25-Apr-2017 14:06:25 Europe/Minsk] PHP Notice:  Unknown: Invalid quoted-printable sequence: =In response to your recent email )

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

� (errflg=3) in Unknown on line 0

It still retuned the emails but I cant convert the data to JSON now. The attachments is a small png image.

abdullahseba avatar Apr 25 '17 11:04 abdullahseba

Hmm. The symbol part I know is part of the source of the png file. Meaning we are not properly reading it.

mattparksjr avatar Apr 25 '17 11:04 mattparksjr

What are we talking about?

sergey144010 avatar Apr 25 '17 16:04 sergey144010

Recalculate letters using $imap->count, next cycle, find id error message and exept it, and next show me structure this letter.

sergey144010 avatar Apr 25 '17 16:04 sergey144010

$imap->count? not sure what to do.

abdullahseba avatar Apr 25 '17 18:04 abdullahseba

Make this

$count = $imap->countMessages();
for($i=1, $i<=$count, $i++){
  print($i);
 $imap->getMessage($i);
}

and show me

sergey144010 avatar Apr 25 '17 18:04 sergey144010

Parse error: syntax error, unexpected ')', expecting ';'

abdullahseba avatar Apr 25 '17 18:04 abdullahseba

Tried to fix it

abdullahseba avatar Apr 25 '17 18:04 abdullahseba

Change , -> ; in

for($i=1; $i<=$count; $i++)

sergey144010 avatar Apr 25 '17 18:04 sergey144010

123456789101112131415161718192021222324
Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

abdullahseba avatar Apr 25 '17 18:04 abdullahseba

Ok, For accuracy

$imap->getMessage(24);

sergey144010 avatar Apr 25 '17 18:04 sergey144010

and show me

$imap->getMessage(24);
var_dump($imap->incomingMessage);

sergey144010 avatar Apr 25 '17 18:04 sergey144010

123456789101112131415161718192021222324
Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

abdullahseba avatar Apr 25 '17 19:04 abdullahseba

Cant var_dump($imap->incomingMessage); here theres too much

abdullahseba avatar Apr 25 '17 19:04 abdullahseba

at least

var_dump($imap->incomingMessage->structure);

sergey144010 avatar Apr 25 '17 19:04 sergey144010

And in general, make it easier:

$count = $imap->countMessages();
for($i=1, $i<=$count, $i++){
  print($i);
 $imap->getMessage($i, IncomingMessage::NOT_DECODE);
}

Errors?

sergey144010 avatar Apr 25 '17 19:04 sergey144010

Fatal error: Uncaught Error: Class 'IncomingMessage' not found

abdullahseba avatar Apr 25 '17 20:04 abdullahseba

<?php
namespace program;

# Here Autoload
require_once "vendor/autoload.php";

# Here namespace used
use SSilence\ImapClient\IncomingMessage;

try{
    $imap = new ImapClient( $hereYouConfig );

# Here you code ...

}catch (ImapClientException $error){
    echo $error->getInfo();
};

sergey144010 avatar Apr 26 '17 06:04 sergey144010

1
Fatal error: Uncaught Error: Class 'IncomingMessage' not found in C:\xampp\htdocs\mail2\1.php:17 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mail2\1.php on line 17

abdullahseba avatar Apr 26 '17 07:04 abdullahseba

I will translate to you your mistake: Class 'IncomingMessage' not found in 1.php You not use Autoload like this

require_once "vendor/autoload.php";

or this

require_once "../autoload.php";

or this

require_once "autoload.php";

What autoload do you use where you have it?

sergey144010 avatar Apr 26 '17 07:04 sergey144010

nope my code is fine require_once "vendor/autoload.php"; it works for everything else but this

$count = $imap->countMessages();
for($i=1; $i<=$count; $i++){
  print($i);
 $imap->getMessage($i, IncomingMessage::NOT_DECODE);
}

abdullahseba avatar Apr 26 '17 07:04 abdullahseba

Show you C:\xampp\htdocs\mail2\1.php

sergey144010 avatar Apr 26 '17 17:04 sergey144010

<?php
require_once 'vendor/autoload.php';
use SSilence\ImapClient\ImapClient;

$mailbox = 'mail.e17pumphouse.org.uk';
$username = '[email protected]';
$password = 'password';
$encryption = ImapClient::ENCRYPT_SSL; // or ImapClient::ENCRYPT_SSL or ImapClient::ENCRYPT_TLS or null

try{
$imap = new ImapClient($mailbox, $username, $password, $encryption);


$count = $imap->countMessages();
for($i=1; $i<=$count; $i++){
  print($i);
 $imap->getMessage($i, IncomingMessage::NOT_DECODE);
}

}catch (ImapClientException $error){
    echo $error->getInfo();
};

abdullahseba avatar Apr 26 '17 18:04 abdullahseba

Its my testing code works for the other functions.

abdullahseba avatar Apr 26 '17 18:04 abdullahseba

<?php
require_once 'vendor/autoload.php';

use SSilence\ImapClient\ImapClient;
use SSilence\ImapClient\IncomingMessage;

$mailbox = 'mail.e17pumphouse.org.uk';
$username = '[email protected]';
$password = 'password';
$encryption = ImapClient::ENCRYPT_SSL; // or ImapClient::ENCRYPT_SSL or ImapClient::ENCRYPT_TLS or null

try{
$imap = new ImapClient($mailbox, $username, $password, $encryption);


$count = $imap->countMessages();
for($i=1; $i<=$count; $i++){
  print($i);
 $imap->getMessage($i, IncomingMessage::NOT_DECODE);
}

}catch (ImapClientException $error){
    echo $error->getInfo();
};

sergey144010 avatar Apr 26 '17 21:04 sergey144010

1234567891011121314151617181920212223

abdullahseba avatar Apr 26 '17 21:04 abdullahseba

Letter with $id = 24, where? before

123456789101112131415161718192021222324
Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

after

1234567891011121314151617181920212223

where 24?

sergey144010 avatar Apr 27 '17 07:04 sergey144010

$imap->getMessage(24);
var_dump($imap->incomingMessage->structure);

sergey144010 avatar Apr 27 '17 07:04 sergey144010

I set $id = 20 cuz I dont have 24 emails.

object(stdClass)#4 (11) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(11) "ALTERNATIVE" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#5 (2) { ["attribute"]=> string(8) "boundary" ["value"]=> string(61) "_000_VI1PR09MB044857C4E489FDA961E1D4F8FC1C0VI1PR09MB0448eurp_" } } ["parts"]=> array(2) { [0]=> object(stdClass)#6 (12) { ["type"]=> int(0) ["encoding"]=> int(4) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "PLAIN" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(6) ["bytes"]=> int(40) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#7 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(10) "iso-8859-1" } } } [1]=> object(stdClass)#8 (12) { ["type"]=> int(0) ["encoding"]=> int(4) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "HTML" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(21) ["bytes"]=> int(505) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#9 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(10) "iso-8859-1" } } } } }

abdullahseba avatar Apr 27 '17 09:04 abdullahseba

Before the error occurred in 24, and now in 20?

sergey144010 avatar Apr 27 '17 12:04 sergey144010

oh, no its 23

object(stdClass)#4 (11) { ["type"]=> int(1) ["encoding"]=> int(0) ["ifsubtype"]=> int(1) ["subtype"]=> string(11) "ALTERNATIVE" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#5 (2) { ["attribute"]=> string(8) "boundary" ["value"]=> string(26) "=-Rs/ECVAJ/Oxgjv7XBMCdgQ==" } } ["parts"]=> array(2) { [0]=> object(stdClass)#6 (12) { ["type"]=> int(0) ["encoding"]=> int(4) ["ifsubtype"]=> int(1) ["subtype"]=> string(5) "PLAIN" ["ifdescription"]=> int(0) ["ifid"]=> int(0) ["lines"]=> int(41) ["bytes"]=> int(1366) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#7 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(5) "utf-8" } } } [1]=> object(stdClass)#8 (13) { ["type"]=> int(0) ["encoding"]=> int(4) ["ifsubtype"]=> int(1) ["subtype"]=> string(4) "HTML" ["ifdescription"]=> int(0) ["ifid"]=> int(1) ["id"]=> string(44) "<4TLG3JHY41U4.ZOH0FF8AN9P73@EU1DME-DROID12P>" ["lines"]=> int(561) ["bytes"]=> int(38195) ["ifdisposition"]=> int(0) ["ifdparameters"]=> int(0) ["ifparameters"]=> int(1) ["parameters"]=> array(1) { [0]=> object(stdClass)#9 (2) { ["attribute"]=> string(7) "charset" ["value"]=> string(5) "utf-8" } } } } } 
Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0

abdullahseba avatar Apr 27 '17 13:04 abdullahseba