Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.10.1 - [RELEASEDATE]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Fixed #97: Zoho IMAP authentication fails, as there is an extra line in the
response, just like GMail does.


1.10.0 - Wednesday 12 March 2025
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
25 changes: 21 additions & 4 deletions src/transports/imap/imap_transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ class ezcMailImapTransport
*/
const SERVER_GIMAP = 'Gimap';

/**
* The string returned by Zoho IMAP servers at connection time.
*
* @access private
*/
const SERVER_ZOHO = 'Zoho Mail';

/**
* Authenticate with 'AUTH LOGIN'.
*/
Expand Down Expand Up @@ -332,7 +339,8 @@ class ezcMailImapTransport
* Holds the string which identifies the IMAP server type.
*
* Used for fixing problems with Google IMAP (see issue #14360). Possible
* values are {@link self::SERVER_GIMAP} or null for all other servers.
* values are {@link self::SERVER_GIMAP}, {@link self::SERVER_ZOHO}, or
* null for all other servers.
*
* @todo Add identification strings for each existing IMAP server?
*
Expand Down Expand Up @@ -407,10 +415,16 @@ public function __construct( $server, $port = null, $options = array() )
{
throw new ezcMailTransportException( "The connection to the IMAP server is ok, but a negative response from server was received. Try again later." );
}

if ( strpos( $response, self::SERVER_GIMAP ) !== false )
{
$this->serverType = self::SERVER_GIMAP; // otherwise it is null
}
if ( strpos( $response, self::SERVER_ZOHO ) !== false )
{
$this->serverType = self::SERVER_ZOHO; // otherwise it is null
}

$this->state = self::STATE_NOT_AUTHENTICATED;
}

Expand Down Expand Up @@ -585,9 +599,12 @@ public function authenticate( $user, $password, $method = ezcMailImapTransport::

}
$response = trim( $this->connection->getLine() );
// hack for gmail, to fix issue #15837: imap.google.com (google gmail) changed IMAP response
if ( $this->serverType === self::SERVER_GIMAP && strpos( $response, "* CAPABILITY" ) === 0 )
{
// Hacks for Zoho Mail, and Gmail, to fix issue #15837: imap.google.com (google gmail) changed IMAP response
if (
( $this->serverType === self::SERVER_GIMAP || $this->serverType === self::SERVER_ZOHO )
&&
strpos( $response, "* CAPABILITY" ) === 0
) {
$response = trim( $this->connection->getLine() );
}
if ( strpos( $response, '* OK' ) !== false )
Expand Down
Loading