Anyone succesfully setup autodiscover for outlook in Office365

marson

Verified User
Joined
Jan 30, 2012
Messages
60
Hello

I am trying to setup autodiscover functionality as described here https://forum.directadmin.com/threads/guide-for-autodiscover.58483/ unfortunately on recent version of Outlook from Office365 it doesn't work simply not detecting any settings, when I enter the http://domain.com/autodiscover I am getting blank page with nothing on the log and the content of Autodiscover.xml/index.php looks like this:

Code:
<?php
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

$raw = file_get_contents('php://input');
$matches = array();
preg_match('/<EMailAddress>(.*)<\/EMailAddress>/', $raw, $matches);
$email = $matches[1];

if (!filter_var($email,FILTER_VALIDATE_EMAIL)){
        // plonk, no remorse
        die();
}

list($user,$domain) = preg_split("/@/",$email,2);

header('Content-Type: application/xml');
?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
  <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
    <User>
      <DisplayName><?=$email?></DisplayName>
    </User>
    <Account>
      <AccountType>email</AccountType>
      <Action>settings</Action>
      <Protocol>
        <Type>IMAP</Type>
        <Server>serwer.mydomain.pl</Server>
        <Port>993</Port>
        <DomainRequired>off</DomainRequired>
        <SPA>off</SPA>
        <SSL>on</SSL>
        <AuthRequired>on</AuthRequired>
        <LoginName><?=$email?></LoginName>
      </Protocol>
      <Protocol>
        <Type>SMTP</Type>
        <Server>serwer.mydomain.pl</Server>
        <Port>587</Port>
        <DomainRequired>off</DomainRequired>
        <SPA>off</SPA>
        <SSL>on</SSL>
        <AuthRequired>on</AuthRequired>
        <LoginName><?=$email?></LoginName>
      </Protocol>
    </Account>
  </Response>
</Autodiscover>

the only difference in my config from this described in the link that I posted above is that I put following line:

alias /Autodiscover/Autodiscover.xml /var/www/html/Autodiscover/Autodiscover.xml/index.php
in /usr/local/directadmin/custombuild/custom/ap2/conf/extra/httpd-alias.conf then ./build rewrite_confs rather than doing this

Code:
cd /usr/local/directadmin/custombuild
echo 'Autodiscover/Autodiscover.xml=Autodiscover/Autodiscover.xml' >> custom/webapps.list
./build rewrite_confs

because the line placed as described in how-to not working for me for some reasons displaying 404 when I try to display /Autodiscover/Autodiscover.xml in the browser.

Can anybody help me with this?
 
Back
Top