Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $postData = file_get_contents("php://input"); //Autodiscover requests are HTTP posts with XML content
- $xml = simplexml_load_string($postData);
- $user = $xml->Request->EMailAddress; //copy the email address from the request into a variable
- $domain = substr($user, strpos($user, '@') + 1); // get the domain name from the email address
- //set Content-Type
- header("Content-Type: application/xml"); ?>
- <?php echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>
- <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
- <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
- <Account>
- <AccountType>email</AccountType>
- <Action>settings</Action>
- <Protocol>
- <Type>IMAP</Type>
- <Server>mail.example.tld</Server>
- <Port>993</Port>
- <DomainRequired>on</DomainRequired>
- <Domain><?php echo $domain; ?></Domain>
- <LoginName><?php echo $user; ?></LoginName>
- <SPA>off</SPA>
- <SSL>on</SSL>
- <Encryption>TLS</Encryption>
- <AuthRequired>on</AuthRequired>
- </Protocol>
- <Protocol>
- <Type>SMTP</Type>
- <Server>mail.example.tld</Server>
- <Port>587</Port>
- <DomainRequired>on</DomainRequired>
- <Domain><?php echo $domain; ?></Domain>
- <LoginName><?php echo $user; ?></LoginName>
- <SPA>off</SPA>
- <Encryption>TLS</Encryption>
- <AuthRequired>on</AuthRequired>
- <SMTPLast>on</SMTPLast>
- </Protocol>
- </Account>
- </Response>
- </Autodiscover>
Advertisement
Comments
-
- Multi-domain: <Server>mail.<?php echo $domain; ?></Server>
Add Comment
Please, Sign In to add comment
Advertisement