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

View File

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