Commit 944d861a authored by Alan Garcia's avatar Alan Garcia
Browse files

Mail autoconfig charge sa conf depuis les variables AlternC

parent 46669ddd
<?php
require_once("../class/config_nochk.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]);
$f=fopen("/tmp/autodiscover.log","ab");
fputs($f,"Posted: \n".$string."\n");
fclose($f);
$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>
......
<?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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment