update v1.0.6

This commit is contained in:
sujitprasad
2016-02-16 22:42:08 +05:30
parent e6b579d67b
commit 073a49a8af
587 changed files with 21487 additions and 22766 deletions

View File

@@ -29,7 +29,7 @@ Just add following code in the head of your script:
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
### [Usage example](https://github.com/barbushin/php-imap/blob/master/example/index.php)
### Usage example
```php
$mailbox = new PhpImap\Mailbox('{imap.gmail.com:993/imap/ssl}INBOX', 'some@gmail.com', '*********', __DIR__);

View File

@@ -17,11 +17,12 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=5.3.0",
"ext-imap": "*"
},
"autoload": {
"psr-0": {
"PhpImap": "src/"
"psr-4": {
"PhpImap\\": "src/PhpImap/"
}
},
"minimum-stability": "stable"

View File

@@ -62,4 +62,5 @@ class IncomingMailAttachment {
public $id;
public $name;
public $filePath;
public $disposition;
}

View File

@@ -170,7 +170,7 @@ class Mailbox {
*
* @return array Mails ids
*/
public function searchMailbox($criteria = 'ALL') {
public function searchMailbox($criteria = 'UNSEEN') {
$mailsIds = imap_search($this->getImapStream(), $criteria, SE_UID, $this->serverEncoding);
return $mailsIds ? $mailsIds : array();
}
@@ -337,6 +337,17 @@ class Mailbox {
return imap_mailboxmsginfo($this->getImapStream());
}
public function get_overview($mailId) {
$overview = imap_fetch_overview($this->getImapStream(), $mailId, FT_UID);
return $overview;
}
public function backup_getmail($mailId) {
$body = imap_body($this->getImapStream(), $mailId, 1.1);
return $body;
}
/**
* Gets mails ids sorted by some criteria
*
@@ -416,6 +427,7 @@ class Mailbox {
if(isset($head->to)) {
$toStrings = array();
// dd($mail);
foreach($head->to as $to) {
if(!empty($to->mailbox) && !empty($to->host)) {
$toEmail = strtolower($to->mailbox . '@' . $to->host);
@@ -439,10 +451,6 @@ class Mailbox {
}
}
if(isset($head->message_id)) {
$mail->messageId = $head->message_id;
}
$mailStructure = imap_fetchstructure($this->getImapStream(), $mailId, FT_UID);
if(empty($mailStructure->parts)) {
@@ -471,7 +479,6 @@ class Mailbox {
$data = imap_binary($data);
}
elseif($partStructure->encoding == 3) {
$data = preg_replace('~[^a-zA-Z0-9+=/]+~s', '', $data); // https://github.com/barbushin/php-imap/issues/88
$data = imap_base64($data);
}
elseif($partStructure->encoding == 4) {
@@ -521,7 +528,7 @@ class Mailbox {
'/(^_)|(_$)/' => '',
);
$fileSysName = preg_replace('~[\\\\/]~', '', $mail->id . '_' . $attachmentId . '_' . preg_replace(array_keys($replace), $replace, $fileName));
$attachment->filePath = $this->attachmentsDir . DIRECTORY_SEPARATOR . $fileSysName;
$attachment->filePath = $this->attachmentsDir .'../../../../../../public'. DIRECTORY_SEPARATOR . $fileSysName;
file_put_contents($attachment->filePath, $data);
}
$mail->addAttachment($attachment);