php-imap-client
php-imap-client copied to clipboard
Email with attachments result in error.
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.
Hmm. The symbol part I know is part of the source of the png file. Meaning we are not properly reading it.
What are we talking about?
Recalculate letters using $imap->count, next cycle, find id error message and exept it, and next show me structure this letter.
$imap->count?
not sure what to do.
Make this
$count = $imap->countMessages();
for($i=1, $i<=$count, $i++){
print($i);
$imap->getMessage($i);
}
and show me
Parse error: syntax error, unexpected ')', expecting ';'
Tried to fix it
Change , -> ; in
for($i=1; $i<=$count; $i++)
123456789101112131415161718192021222324
Notice: Unknown: Invalid quoted-printable sequence: =In response to your recent email ) -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- � (errflg=3) in Unknown on line 0
Ok, For accuracy
$imap->getMessage(24);
and show me
$imap->getMessage(24);
var_dump($imap->incomingMessage);
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
Cant var_dump($imap->incomingMessage); here theres too much
at least
var_dump($imap->incomingMessage->structure);
And in general, make it easier:
$count = $imap->countMessages();
for($i=1, $i<=$count, $i++){
print($i);
$imap->getMessage($i, IncomingMessage::NOT_DECODE);
}
Errors?
Fatal error: Uncaught Error: Class 'IncomingMessage' not found
<?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();
};
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
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?
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);
}
Show you C:\xampp\htdocs\mail2\1.php
<?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();
};
Its my testing code works for the other functions.
<?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();
};
1234567891011121314151617181920212223
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?
$imap->getMessage(24);
var_dump($imap->incomingMessage->structure);
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" } } } } }
Before the error occurred in 24, and now in 20?
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