Skip to content

Can't able to connect outlook/hotmail emails of office 365 #735

Open
@kefihin

Description

@kefihin

Hello there,

I'm trying to establish an IMAP connection to an Outlook email account using the following PHP code:

$mailbox = new Mailbox(
    '{outlook.office365.com:993/imap/ssl}INBOX',
    [email protected],
    APP_PASSWORD,
    __DIR__,
    'UTF-8'
);

try {
    $mailbox->setAttachmentsIgnore(true);
    $mailsIds = $mailbox->searchMailbox('ALL');
    echo "Found " . count($mailsIds) . " emails.";
} catch (Exception $e) {
    echo "IMAP connection failed: " . $e->getMessage();
}
exit;

However, I'm encountering the following error:

IMAP Authentication cancelledPHP Notice:  Unknown: IMAP Authentication cancelled (errflg=2) in Unknown on line 0

I've tried using an app password, but the issue persists. Could you please advise on how to resolve this? I'm currently blocked and would greatly appreciate your prompt support.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs investigationThis will be tested / debugged or checked out.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions