Mail autoconfig charge sa conf depuis les variables AlternC

This commit is contained in:
Alan Garcia 2013-07-22 16:44:29 +00:00
parent 46669dddf7
commit 944d861a16
2 changed files with 21 additions and 21 deletions

View File

@ -1,18 +1,16 @@
<?php
// Created by Alesandro Slepcevic - alesandro@plus.hr
//header(':', true, 405);
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){
$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]);
require_once("../class/config_nochk.php");
$f=fopen("/tmp/autodiscover.log","ab");
fputs($f,"Posted: \n".$string."\n");
fclose($f);
// Created by Alesandro Slepcevic - alesandro@plus.hr
if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){
$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]);
}
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?> \n";
?>
@ -23,7 +21,7 @@ echo "<?xml version='1.0' encoding='UTF-8'?> \n";
<Action>settings</Action>
<Protocol>
<Type>IMAP</Type>
<Server><?php echo exec('hostname -f');?></Server>
<Server><?php echo $mail->srv_imaps;?></Server>
<Port>993</Port>
<LoginName><?php echo $matches[0];?></LoginName>
<DomainName><?php echo $emailDomain[1];?></DomainName>
@ -33,7 +31,7 @@ echo "<?xml version='1.0' encoding='UTF-8'?> \n";
</Protocol>
<Protocol>
<Type>SMTP</Type>
<Server><?php echo exec('hostname -f');?></Server>
<Server><?php echo $mail->srv_smtps;?></Server>
<Port>587</Port>
<SPA>off</SPA>
<SSL>on</SSL>

View File

@ -1,35 +1,37 @@
<?php
require_once("../class/config_nochk.php");
header ("Content-Type:text/xml");
$emailDomain = explode('@', rawurldecode($_GET['emailaddress']));
?>
<clientConfig version="1.1">
<emailProvider id="octopuce.fr">
<emailProvider id="<?php echo $L_FQDN ?>">
<domain><?php echo $emailDomain;?></domain>
<displayName>Octopuce SARL</displayName>
<displayShortName>Octopuce</displayShortName>
<displayName><?php echo $L_FQDN ?></displayName>
<displayShortName><?php echo $L_FQDN ?></displayShortName>
<incomingServer type="imap">
<hostname><?php echo exec('hostname -f');?></hostname>
<hostname><?php echo $mail->srv_imap ;?></hostname>
<port>993</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<incomingServer type="pop3">
<hostname><?php echo exec('hostname -f');?></hostname>
<hostname><?php echo $mail->srv_imaps;?></hostname>
<port>995</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<outgoingServer type="smtp">
<hostname><?php echo exec('hostname -f');?></hostname>
<hostname><?php echo $mail->srv_smtp;?></hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<username>%EMAILADDRESS%</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
<outgoingServer type="smtp">
<hostname><?php echo exec('hostname -f');?></hostname>
<hostname><?php echo $mail->srv_smtps;?></hostname>
<port>465</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>