Access Office356 shared mailbox with PHP

前端 未结 2 1225
醉话见心
醉话见心 2020-12-16 07:05

I\'m working on a PHP script to read and parse error logs sent to a shared mailbox.

I\'m using imap_open() to connect.

If I connect with the following creden

2条回答
  •  隐瞒了意图╮
    2020-12-16 07:38

    Another solution that worked for us is to add the username data to the mailbox parameter using the appropriate flags.

    For example, with the Office 365 configuration of

    USER EMAIL: user@maindomain.com
    PASSWORD: password
    SHARED MAILBOX: shared@anotherdomain.com
    

    then the imap_open call would be

    imap_open("{outlook.office365.com:993/imap/ssl/authuser=user@maindomain.com/user=shared@anotherdomain.com}", "user@maindomain.com", "password");
    

    Note the inclusion of the main user email using the /authuser flag and the shared mailbox using the /user flag.

    That worked for us when the mailbox alias approach in the previous answer was not successful.

提交回复
热议问题