Hi All,
I am having an issue with fetch email in Inbox of SharedMailbox from Office365. I had followed the instruction to configure App Registration with the permission as below
The OAuth2 is working.
For the PostMaster Mail, I tried with both IMAPS and IMAPTLS but no luck.
Here is the result of /opt/znuny/bin/otrs.Console.pl Maint::PostMaster::MailAccountFetch --debug
Thank you for your help.
outlook.office365.com (IMAPTLS)...
IMAPTLS: Connection to outlook.office365.com closed.
Started at Wed Mar 26 16:08:27 2025
Using Mail::IMAPClient version 3.43 on perl 5.038002
Connecting with IO::Socket::IP PeerAddr outlook.office365.com PeerPort 143 Proto tcp Timeout 600 Debug 1
Connected to outlook.office365.com
Read: * OK The Microsoft Exchange IMAP4 service is ready. [TQBXADQAUABSADAANABDAEEAMAAyADkAMgAuAG4AYQBtAHAAcgBkADAANAAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
Sending: 1 STARTTLS
Sent 12 bytes
Read: 1 OK Begin TLS negotiation now.
Sending: 2 AUTHENTICATE XOAUTH2
Sent 24 bytes
Read: +
Sending: [Redact: Count=2 Showcredentials=OFF]
Sent 3778 bytes
Read: 2 OK AUTHENTICATE completed.
Sending: 3 SELECT Inbox
Sent 16 bytes
Read: 3 BAD User is authenticated but not connected.
ERROR: 3 BAD User is authenticated but not connected. at /usr/share/perl5/Mail/IMAPClient.pm line 1388.
Mail::IMAPClient::__ANON__("3 BAD User is authenticated but not connected.\x{d}\x{a}") called at /usr/share/perl5/Mail/IMAPClient.pm line 1424
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x5e7b5761ff38), 3, undef) called at /usr/share/perl5/Mail/IMAPClient.pm line 1350
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x5e7b5761ff38), "SELECT Inbox") called at /usr/share/perl5/Mail/IMAPClient.pm line 1248
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x5e7b5761ff38), "SELECT Inbox") called at /usr/share/perl5/Mail/IMAPClient.pm line 864
Mail::IMAPClient::select(Mail::IMAPClient=HASH(0x5e7b5761ff38), "Inbox") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 301
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 305
Kernel::System::MailAccount::IMAP::__ANON__("select", "Inbox") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 331
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 345
Kernel::System::MailAccount::IMAP::_Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Trusted", 0, "Type", "IMAPTLS", "Host", "outlook.office365.com", "CreateTime", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 157
Kernel::System::MailAccount::IMAP::Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Debug", 1, "********ConfigID", 4, "Password", "********", "Trusted", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount.pm line 650
Kernel::System::MailAccount::MailAccountFetch(Kernel::System::MailAccount=HASH(0x5e7b566a0d78), "********ConfigID", 4, "Password", "********", "Trusted", 0, "Type", ...) called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 174
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 163
Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268)) called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 461
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 455
Kernel::System::Console::BaseCommand::Execute(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268), "--debug") called at /opt/znuny-7.1.6/Kernel/System/Console/InterfaceConsole.pm line 81
Kernel::System::Console::InterfaceConsole::Run(Kernel::System::Console::InterfaceConsole=HASH(0x5e7b55e07b58), "Maint::PostMaster::MailAccountFetch", "--debug") called at /opt/znuny/bin/otrs.Console.pl line 37
ERROR: 3 BAD User is authenticated but not connected. at /usr/share/perl5/Mail/IMAPClient.pm line 1298.
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x5e7b5761ff38), "SELECT Inbox") called at /usr/share/perl5/Mail/IMAPClient.pm line 864
Mail::IMAPClient::select(Mail::IMAPClient=HASH(0x5e7b5761ff38), "Inbox") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 301
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 305
Kernel::System::MailAccount::IMAP::__ANON__("select", "Inbox") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 331
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 345
Kernel::System::MailAccount::IMAP::_Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Trusted", 0, "Type", "IMAPTLS", "Host", "outlook.office365.com", "CreateTime", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 157
Kernel::System::MailAccount::IMAP::Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Debug", 1, "********ConfigID", 4, "Password", "********", "Trusted", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount.pm line 650
Kernel::System::MailAccount::MailAccountFetch(Kernel::System::MailAccount=HASH(0x5e7b566a0d78), "********ConfigID", 4, "Password", "********", "Trusted", 0, "Type", ...) called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 174
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 163
Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268)) called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 461
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 455
Kernel::System::Console::BaseCommand::Execute(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268), "--debug") called at /opt/znuny-7.1.6/Kernel/System/Console/InterfaceConsole.pm line 81
Kernel::System::Console::InterfaceConsole::Run(Kernel::System::Console::InterfaceConsole=HASH(0x5e7b55e07b58), "Maint::PostMaster::MailAccountFetch", "--debug") called at /opt/znuny/bin/otrs.Console.pl line 37
ERROR: Znuny-znuny.Console.pl-Maint::PostMaster::MailAccountFetch-10 Perl: 5.38.2 OS: linux Time: Wed Mar 26 16:08:44 2025
Message: Error while retrieving the messages 'IMAPTLS': Could not select:
Traceback (13088):
Module: Kernel::System::MailAccount::IMAP::_Fetch Line: 347
Module: Kernel::System::MailAccount::IMAP::Fetch Line: 157
Module: Kernel::System::MailAccount::MailAccountFetch Line: 650
Module: (eval) Line: 174
Module: Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run Line: 163
Module: (eval) Line: 461
Module: Kernel::System::Console::BaseCommand::Execute Line: 455
Module: Kernel::System::Console::InterfaceConsole::Run Line: 81
Module: /opt/znuny/bin/otrs.Console.pl Line: 37
Sending: 4 CLOSE
Sent 9 bytes
Read: 4 BAD User is authenticated but not connected.
* BYE Connection closed. 14
ERROR: 4 BAD User is authenticated but not connected. at /usr/share/perl5/Mail/IMAPClient.pm line 1388.
Mail::IMAPClient::__ANON__("4 BAD User is authenticated but not connected.\x{d}\x{a}") called at /usr/share/perl5/Mail/IMAPClient.pm line 1424
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x5e7b5761ff38), 4, undef) called at /usr/share/perl5/Mail/IMAPClient.pm line 1350
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x5e7b5761ff38), "CLOSE") called at /usr/share/perl5/Mail/IMAPClient.pm line 1248
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x5e7b5761ff38), "CLOSE") called at /usr/share/perl5/Mail/IMAPClient.pm line 2379
Mail::IMAPClient::close(Mail::IMAPClient=HASH(0x5e7b5761ff38)) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 301
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 305
Kernel::System::MailAccount::IMAP::__ANON__("close") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 521
Kernel::System::MailAccount::IMAP::_Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Trusted", 0, "Type", "IMAPTLS", "Host", "outlook.office365.com", "CreateTime", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 157
Kernel::System::MailAccount::IMAP::Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Debug", 1, "********ConfigID", 4, "Password", "********", "Trusted", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount.pm line 650
Kernel::System::MailAccount::MailAccountFetch(Kernel::System::MailAccount=HASH(0x5e7b566a0d78), "********ConfigID", 4, "Password", "********", "Trusted", 0, "Type", ...) called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 174
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 163
Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268)) called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 461
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 455
Kernel::System::Console::BaseCommand::Execute(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268), "--debug") called at /opt/znuny-7.1.6/Kernel/System/Console/InterfaceConsole.pm line 81
Kernel::System::Console::InterfaceConsole::Run(Kernel::System::Console::InterfaceConsole=HASH(0x5e7b55e07b58), "Maint::PostMaster::MailAccountFetch", "--debug") called at /opt/znuny/bin/otrs.Console.pl line 37
ERROR: * BYE Connection closed. 14 at /usr/share/perl5/Mail/IMAPClient.pm line 1439.
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x5e7b5761ff38), 4, undef) called at /usr/share/perl5/Mail/IMAPClient.pm line 1350
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x5e7b5761ff38), "CLOSE") called at /usr/share/perl5/Mail/IMAPClient.pm line 1248
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x5e7b5761ff38), "CLOSE") called at /usr/share/perl5/Mail/IMAPClient.pm line 2379
Mail::IMAPClient::close(Mail::IMAPClient=HASH(0x5e7b5761ff38)) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 301
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 305
Kernel::System::MailAccount::IMAP::__ANON__("close") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 521
Kernel::System::MailAccount::IMAP::_Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Trusted", 0, "Type", "IMAPTLS", "Host", "outlook.office365.com", "CreateTime", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 157
Kernel::System::MailAccount::IMAP::Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Debug", 1, "********ConfigID", 4, "Password", "********", "Trusted", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount.pm line 650
Kernel::System::MailAccount::MailAccountFetch(Kernel::System::MailAccount=HASH(0x5e7b566a0d78), "********ConfigID", 4, "Password", "********", "Trusted", 0, "Type", ...) called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 174
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 163
Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268)) called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 461
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 455
Kernel::System::Console::BaseCommand::Execute(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268), "--debug") called at /opt/znuny-7.1.6/Kernel/System/Console/InterfaceConsole.pm line 81
Kernel::System::Console::InterfaceConsole::Run(Kernel::System::Console::InterfaceConsole=HASH(0x5e7b55e07b58), "Maint::PostMaster::MailAccountFetch", "--debug") called at /opt/znuny/bin/otrs.Console.pl line 37
ERROR: * BYE Connection closed. 14 at /usr/share/perl5/Mail/IMAPClient.pm line 1298.
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x5e7b5761ff38), "CLOSE") called at /usr/share/perl5/Mail/IMAPClient.pm line 2379
Mail::IMAPClient::close(Mail::IMAPClient=HASH(0x5e7b5761ff38)) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 301
eval {...} called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 305
Kernel::System::MailAccount::IMAP::__ANON__("close") called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 521
Kernel::System::MailAccount::IMAP::_Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Trusted", 0, "Type", "IMAPTLS", "Host", "outlook.office365.com", "CreateTime", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount/IMAP.pm line 157
Kernel::System::MailAccount::IMAP::Fetch(Kernel::System::MailAccount::IMAPTLS=HASH(0x5e7b567c80f0), "Debug", 1, "********ConfigID", 4, "Password", "********", "Trusted", ...) called at /opt/znuny-7.1.6/Kernel/System/MailAccount.pm line 650
Kernel::System::MailAccount::MailAccountFetch(Kernel::System::MailAccount=HASH(0x5e7b566a0d78), "********ConfigID", 4, "Password", "********", "Trusted", 0, "Type", ...) called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 174
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/Command/Maint/PostMaster/MailAccountFetch.pm line 163
Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch::Run(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268)) called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 461
eval {...} called at /opt/znuny-7.1.6/Kernel/System/Console/BaseCommand.pm line 455
Kernel::System::Console::BaseCommand::Execute(Kernel::System::Console::Command::Maint::PostMaster::MailAccountFetch=HASH(0x5e7b55df5268), "--debug") called at /opt/znuny-7.1.6/Kernel/System/Console/InterfaceConsole.pm line 81
Kernel::System::Console::InterfaceConsole::Run(Kernel::System::Console::InterfaceConsole=HASH(0x5e7b55e07b58), "Maint::PostMaster::MailAccountFetch", "--debug") called at /opt/znuny/bin/otrs.Console.pl line 37
Cannot Fetch Email from Sharedmailbox from Office365
Moderator: crythias
Cannot Fetch Email from Sharedmailbox from Office365
You do not have the required permissions to view the files attached to this post.
-
- Znuny newbie
- Posts: 8
- Joined: 03 Jul 2024, 11:48
- Znuny Version: all
- Real Name: Christian
- Company: Znuny GmbH
Re: Cannot Fetch Email from Sharedmailbox from Office365
Hello,
The error message indicates that the token is not working anymore.
To resolve the issue, you need to grant your O365 account full access rights to the mailbox.
After that, request a new authentication token, which should successfully resolve the problem.
Please let us know if the issue has been resolved.
-Christian
The error message indicates that the token is not working anymore.
To resolve the issue, you need to grant your O365 account full access rights to the mailbox.
After that, request a new authentication token, which should successfully resolve the problem.
Please let us know if the issue has been resolved.
-Christian
-
- Znuny superhero
- Posts: 656
- Joined: 24 Feb 2012, 03:58
- Znuny Version: LTS and Features
- Real Name: Mo Azfar
- Location: Kuala Lumpur, MY
- Contact:
Re: Cannot Fetch Email from Sharedmailbox from Office365
Additionally, when requesting new token (1st time), use incognito mode
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English