-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some issues, improved library and PHPUnit tests
- Updated README - Move phpunit to require-dev - Add note about installing dev dependencies in README - Replaced spaces with tabs - Added PHPUnit tests for MIME decoding - Updated formatting of PHPUnit function testParsedDateTimeWithEmptyHeaderDate() - Issue #209: Function to parse datetime correctly RFC2822 - Issue #280: Added 'Sender' to headers and added additional if-conditions - Issue #115: getMail() method returns an object even for nonexistent mail ID - Issue #273: Added connection check to example - Issue #227: Added Failed-Recipients to IncomingMailHeader - Issue #140, #246: Improved exception handling and added PHPUnit test - Issue #140: Added PHPUnit test for testing ConnectionException - Issue #140: Improved exception / error handling and improved / added PHPUnit tests - Issue #154: Added ability to change the imap_search option from SE_UID to SE_FREE and added PHPUnit tests - Issue #306: Added support for US-ASCII and added ability to disable serverEncoding for searchMailbox() - Imported missing namespaces to avoid 'unknown class' error messages - Issue #86: Simplified and improved one replace regex for attachment file names - Issue #247: Improved grabbing of fromName, fromHost, senderName and senderHost - Issue #39, #71, #229: Fixed body content gets incorrectly processed as attachments - Issue #122, #150, #167: Added ability to skip processing of attachments to increase performance, when attachments are not required - PR #284: Added missing PHPUnit tests - Issue #122, #150, #167: Lazy load message text and attachments data
- Loading branch information
Showing
9 changed files
with
821 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php namespace PhpImap; | ||
|
||
/** | ||
* @see https://github.com/barbushin/php-imap | ||
* @author nickl- http://github.com/nickl- | ||
*/ | ||
class DataPartInfo { | ||
|
||
const TEXT_PLAIN = 0; | ||
const TEXT_HTML = 1; | ||
|
||
public $id; | ||
public $encoding; | ||
public $charset; | ||
public $part; | ||
public $mail; | ||
public $options; | ||
private $data; | ||
|
||
public function __construct($mail, $id, $part, $encoding, $options) { | ||
$this->mail = $mail; | ||
$this->id = $id; | ||
$this->part = $part; | ||
$this->encoding = $encoding; | ||
$this->options = $options; | ||
} | ||
|
||
function fetch() { | ||
if(isset($this->data)) { | ||
return $this->data; | ||
} | ||
if($this->part == 0) { | ||
$this->data = $this->mail->imap('body', [$this->id, $this->options]); | ||
} | ||
else { | ||
$this->data = $this->mail->imap('fetchbody', [$this->id, $this->part, $this->options]); | ||
} | ||
switch($this->encoding) { | ||
case ENC8BIT: | ||
$this->data = imap_utf8($this->data); | ||
break; | ||
case ENCBINARY: | ||
$this->data = imap_binary($this->data); | ||
break; | ||
case ENCBASE64: | ||
$this->data = preg_replace('~[^a-zA-Z0-9+=/]+~s', '', $this->data); // https://github.com/barbushin/php-imap/issues/88 | ||
$this->data = imap_base64($this->data); | ||
break; | ||
case ENCQUOTEDPRINTABLE: | ||
$this->data = quoted_printable_decode($this->data); | ||
break; | ||
} | ||
if(isset($this->charset)) { | ||
$this->data = $this->mail->convertStringEncoding($this->data, $this->charset, $this->mail->getServerEncoding()); | ||
} | ||
return $this->data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace PhpImap\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* @see https://github.com/barbushin/php-imap | ||
* @author Barbushin Sergey http://linkedin.com/in/barbushin | ||
*/ | ||
class ConnectionException extends Exception {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace PhpImap\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* @see https://github.com/barbushin/php-imap | ||
* @author Barbushin Sergey http://linkedin.com/in/barbushin | ||
*/ | ||
class InvalidParameterException extends Exception {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.