[sync] Enhance ActiveSync :: Extend Autodiscover.php answer MS Outlook Autodiscover attempts

Torben Dannhauer torben at dannhauer.info
Sun Nov 4 17:30:16 UTC 2012


Hi,,

 

I have submitted a feature enhancement to Horde which allows horde to answer
auto discover attempts of MS Outlook correctly.

This allows Outlook is to auto configure the account only by typing in the
Name, Username and password.

 

The submitted ticket is 11639 (http://bugs.horde.org/ticket/11639)

 

Here you can find the details to implement it besides the office
implementation status:

 

------------- Ticket 11639 ------------------

The AutoDiscover feature could be enhanced to answer also queries  
performed  by Microsoft Outlook Mail clients.

Mail clients like Outlook 2010 and older should auto discover there  
IMAP/SMTP settings, Outlook 2013 clients could be handled seperately  
to allow ActiveSync connections once EAS Protocoll 14.1 or above is  
implemented in Horde.

This Ticket relies an the implementation submitted in Horde Ticket  
11637 ( <http://bugs.horde.org/ticket/11637>
http://bugs.horde.org/ticket/11637) to be able to analyze he  
request schema.

Please edit Horde/ActiveSync/Request/Autodiscover.php and enhance the  
function "_buildResponseString($properties)" to:


    protected function _buildResponseString($properties)
     {
         if (stripos($properties['request_schema'],
'autodiscover/mobilesync') !== false) {
             return '<?xml version="1.0" encoding="utf-8"?>
               <Autodiscover  xmlns="
<http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006>
http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
                 <Response  xmlns="
<http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschem
a/2006>
http://schemas.microsoft.com/exchange/autodiscover/mobilesync/responseschema
/2006">
                   <Culture>' . $properties['culture'] . '</Culture>
                   <User>
                     <DisplayName>' . $properties['display_name'] .
'</DisplayName>
                     <EMailAddress>' . $properties['email'] .
'</EMailAddress>
                   </User>
                   <Action>
                     <Settings>
                       <Server>
                         <Type>MobileSync</Type>
                          <Url>' . $properties['url'] . '</Url>
                          <Name>' . $properties['url'] . '</Name>
                        </Server>
                     </Settings>
                   </Action>
                 </Response>
               </Autodiscover>';
         }
         else if (stripos($properties['request_schema'],
'autodiscover/outlook') !== false) {
             //// MS Outlook 2013 (Outlook 15) : Output data for ActiveSync
             //if(preg_match("Microsoft[\.|\s]Outlook[\.|\s]15",
$_SERVER['HTTP_USER_AGENT'])) {
                // Todo: currently not supported by horde because  Outlook
2013 ActiveSync requires EAS Protocol 14.1 or above
            //}
           // Any other MS Outlook version: Output data for IMAP
           if (stripos( $_SERVER['HTTP_USER_AGENT'], 'Outlook') !== false) {
             return '<Autodiscover  xmlns="
<http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006>
http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
               <Response xmlns="' . $properties['response_schema'] . '">
                 <User>
                   <DisplayName>' . $properties['display_name'] .
'</DisplayName>
                 </User>
                 <Account>
                   <AccountType>email</AccountType>
                     <Action>settings</Action>
                       <Protocol>
                         <Type>IMAP</Type>
                         <Server>my-horde.tld</Server>
                         <Port>993</Port>
                         <LoginName>' . $properties['email'] . '</LoginName>
                         <DomainRequired>off</DomainRequired>
                         <SPA>off</SPA>
                         <SSL>on</SSL>
                         <AuthRequired>on</AuthRequired>
                       </Protocol>
                       <Protocol>
                         <Type>POP3</Type>
                         <Server>my-horde.tld</Server>
                         <Port>110</Port>
                         <LoginName>' . $properties['email'] . '</LoginName>
                         <DomainRequired>off</DomainRequired>
                         <SPA>off</SPA>
                         <SSL>on</SSL>
                         <AuthRequired>on</AuthRequired>
                       </Protocol>
                       <Protocol>
                         <Type>SMTP</Type>
                         <Server>my-horde.tld</Server>
                         <Port>465</Port>
                         <LoginName>' . $properties['email'] . '</LoginName>
                         <DomainRequired>off</DomainRequired>
                         <SPA>off</SPA>
                         <SSL>on</SSL>
                         <AuthRequired>on</AuthRequired>
                         <UsePOPAuth>on</UsePOPAuth>
                       </Protocol>
                    </Account>
                 </Response>
              </Autodiscover>';
         }
     }
     else    return(_buildFailureResponse($properties['email'],  "Invalid
autodiscover schema")); // Fallback
}

Please  be aware that this example has hardcoded values in the outlook
response. It should be configurable in the Administration/ActiveSync  prefs.
The following aspects should be configurable:
* Which protocol types should be configured for autodetection (IMAP,  POP3,
SMTP
* The server for each protocol type
* The Port for each protocol type
* If SSL is active for each protocol type
* If SMTP requires Pop-auth

This example with hardcode values is tested and works with MS Outlook 2010.
The ActiveSync profile for MS Outlook 2013 cannot be testet because  Horde
needs to implement EAS protocol 14 to allow MS Outlook  2013 to  be used as
ActiveSync client.

Many Thanks,
Torben Dannhauer

 



More information about the sync mailing list