2013-07-22 15:27:13 +00:00
|
|
|
<?php
|
2017-10-11 09:58:04 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License (GPL)
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show email autoconfiguration xml data for Outlook / Email for windows
|
|
|
|
*
|
|
|
|
* @copyright AlternC-Team 2000-2017 https://alternc.com/
|
|
|
|
*/
|
|
|
|
|
2013-07-22 16:44:29 +00:00
|
|
|
require_once("../class/config_nochk.php");
|
|
|
|
|
2017-10-11 09:58:04 +00:00
|
|
|
/*
|
|
|
|
Test it that way :
|
|
|
|
wget http://FQDN/mailautoconfig_outlook.php -O - --post-data="test@example.tls" -q
|
|
|
|
*/
|
2013-07-22 17:09:03 +00:00
|
|
|
|
2013-07-22 15:27:13 +00:00
|
|
|
// Created by Alesandro Slepcevic - alesandro@plus.hr
|
|
|
|
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){
|
2013-07-22 16:44:29 +00:00
|
|
|
$postText = file_get_contents('php://input');
|
|
|
|
$string = $postText;
|
|
|
|
$matches = array();
|
|
|
|
$pattern = '/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+.([A-Za-z0-9_-][A-Za-z0-9_]+)/';
|
|
|
|
preg_match($pattern, $string, $matches);
|
|
|
|
$emailDomain = explode('@', $matches[0]);
|
2013-07-22 16:51:23 +00:00
|
|
|
} else {
|
|
|
|
die(_('Missing POST of the mail address'));
|
2013-07-22 15:27:13 +00:00
|
|
|
}
|
2013-07-22 16:44:29 +00:00
|
|
|
|
2013-07-22 15:27:13 +00:00
|
|
|
header("Content-type: text/xml");
|
|
|
|
echo "<?xml version='1.0' encoding='UTF-8'?> \n";
|
|
|
|
?>
|
|
|
|
<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>
|
2018-06-22 15:37:04 +00:00
|
|
|
<Server><?php echo $mail->srv_dovecot; ?></Server>
|
2013-07-22 15:27:13 +00:00
|
|
|
<Port>993</Port>
|
|
|
|
<LoginName><?php echo $matches[0];?></LoginName>
|
|
|
|
<DomainName><?php echo $emailDomain[1];?></DomainName>
|
|
|
|
<SPA>off</SPA>
|
|
|
|
<SSL>on</SSL>
|
|
|
|
<AuthRequired>on</AuthRequired>
|
|
|
|
</Protocol>
|
|
|
|
<Protocol>
|
|
|
|
<Type>SMTP</Type>
|
2018-06-22 15:37:04 +00:00
|
|
|
<Server><?php echo $mail->srv_postfix; ?></Server>
|
2013-07-22 15:27:13 +00:00
|
|
|
<Port>587</Port>
|
|
|
|
<SPA>off</SPA>
|
|
|
|
<SSL>on</SSL>
|
|
|
|
<AuthRequired>on</AuthRequired>
|
|
|
|
<UsePOPAuth>on</UsePOPAuth>
|
|
|
|
<SMTPLast>off</SMTPLast>
|
|
|
|
</Protocol>
|
|
|
|
</Account>
|
|
|
|
</Response>
|
|
|
|
</Autodiscover>
|