Last active
June 17, 2022 10:50
-
-
Save razorsedge/398cb8125c426b3ac2d3464857e01a59 to your computer and use it in GitHub Desktop.
Simplified version of https://github.com/mailcow/mailcow-dockerized/blob/master/data/web/autodiscover-json.php for anyone wanting to to support email autodiscovery like at https://github.com/gronke/email-autodiscover . Keywords: GET /autodiscover/autodiscover.json?Email=user%40domain.com&Protocol=ActiveSync&RedirectCount=1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header("Content-Type: application/json"); | |
if ($_GET['Protocol'] == 'ActiveSync') { | |
echo '{"Protocol":"ActiveSync","Url":"https://' . $_SERVER['HTTP_HOST'] . '/Microsoft-Server-ActiveSync"}'; | |
} | |
elseif ($_GET['Protocol'] == 'AutodiscoverV1') { | |
echo '{"Protocol":"AutodiscoverV1","Url":"https://' . $_SERVER['HTTP_HOST'] . '/Autodiscover/Autodiscover.xml"}'; | |
} | |
else { | |
http_response_code(400); | |
echo '{"ErrorCode":"InvalidProtocol","ErrorMessage":"The given protocol value \u0027' . $_GET['Protocol'] . '\u0027 is invalid. Supported values are \u0027ActiveSync,AutodiscoverV1\u0027"}'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment