Access Office356 shared mailbox with PHP

前端 未结 2 1214
醉话见心
醉话见心 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:30

    Try using the account alias

    %USERUPN%/%SHAREDALIAS% for example:-

    user@domain.com/sharedbox where "sharedbox" is the alias of the shared mailbox instead of the full email address

    I've seen different reports of some people using forward slash ( / ) and some using a backslash ( \ )


    Edit

    Are you using the mailbox alias? Do not use sharedbox@shareddomain.com

    Exchange Configuration:

      USER EMAIL: user@maindomain.com
      PASSWORD: password
    
    
    
     SHARED MAILBOX: shared@anotherdomain.com      (could also be @domain.com, of course)
      SHARED MAILBOX ALIAS: shared-mailbox
    

    Note: Please make sure to create the UNIQUE alias always with the mailbox, because it creates the user [alias]@maindomain.com. In this case shared-mailbox@maindomain.com

    Settings for IMAP Configuration:

      EMAIL ADDRESS: shared@anotherdomain.com (shared mailbox)
      IMAP SERVER: outlook.office365.com
      SMTP SERVER: smtp.office365.com
      USERNAME: user@maindomain.com\shared-mailbox  (user\shared mailbox alias)
      PASSWORD: password (user's password)
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题