Alternc  latest
Alternc logiel libre pour l'hébergement
mailautoconfig_outlook.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  ----------------------------------------------------------------------
5  LICENSE
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License (GPL)
9  as published by the Free Software Foundation; either version 2
10  of the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  To read the license please visit http://www.gnu.org/copyleft/gpl.html
18  ----------------------------------------------------------------------
19 */
20 
21 /**
22  * Show email autoconfiguration xml data for Outlook / Email for windows
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config_nochk.php");
28 
29 /*
30  Test it that way :
31  wget http://FQDN/mailautoconfig_outlook.php -O - --post-data="test@example.tls" -q
32 */
33 
34 // Created by Alesandro Slepcevic - alesandro@plus.hr
35 if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){
36  $postText = file_get_contents('php://input');
37  $string = $postText;
38  $matches = array();
39  $pattern = '/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+.([A-Za-z0-9_-][A-Za-z0-9_]+)/';
40  preg_match($pattern, $string, $matches);
41  $emailDomain = explode('@', $matches[0]);
42 } else {
43  die(_('Missing POST of the mail address'));
44 }
45 
46 header("Content-type: text/xml");
47 echo "<?xml version='1.0' encoding='UTF-8'?> \n";
48 ?>
49 <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
50 <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
51  <Account>
52  <AccountType>email</AccountType>
53  <Action>settings</Action>
54  <Protocol>
55  <Type>IMAP</Type>
56  <Server><?php echo $mail->srv_dovecot; ?></Server>
57  <Port>993</Port>
58  <LoginName><?php echo $matches[0];?></LoginName>
59  <DomainName><?php echo $emailDomain[1];?></DomainName>
60  <SPA>off</SPA>
61  <SSL>on</SSL>
62  <AuthRequired>on</AuthRequired>
63  </Protocol>
64  <Protocol>
65  <Type>SMTP</Type>
66  <Server><?php echo $mail->srv_postfix; ?></Server>
67  <Port>587</Port>
68  <SPA>off</SPA>
69  <SSL>on</SSL>
70  <AuthRequired>on</AuthRequired>
71  <UsePOPAuth>on</UsePOPAuth>
72  <SMTPLast>off</SMTPLast>
73  </Protocol>
74  </Account>
75 </Response>
76 </Autodiscover>
$string
Definition: logs_tail.php:38
if(empty($_GET['emailaddress'])) die(_("Error $emailDomain