92 lines
2.5 KiB
PHP
92 lines
2.5 KiB
PHP
|
<?php
|
||
|
/*
|
||
|
* @AUTHOR: Gurkengewuerz
|
||
|
* @REVIEW: 05.03.2017
|
||
|
* @DESCRIPTION: Thunderbird Autoconfig
|
||
|
* @SOURCE: https://github.com/biapy/howto.biapy.com/blob/master/various/thunderbird-autoconfig-xml.php
|
||
|
*
|
||
|
* DNS:
|
||
|
* autoconfig.example.com. 219 IN A 101.203.15.106
|
||
|
*
|
||
|
* NGINX Config:
|
||
|
* server {
|
||
|
* listen 80;
|
||
|
* listen [::]:80;
|
||
|
* server_name autoconfig.*;
|
||
|
* root /var/www/html/autoconfig;
|
||
|
* rewrite ^/mail/config-v1\.1\.xml(\?)?(.*)$ /autoconfig.php break;
|
||
|
* rewrite ^/mail/config-v1\.1\.xml\?emailadress=(.*)$ /autoconfig.php?($1) break;
|
||
|
*
|
||
|
* location ~ \.php$ {
|
||
|
* try_files $uri =404;
|
||
|
* fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
|
||
|
* fastcgi_index index.php;
|
||
|
* fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||
|
* include fastcgi_params;
|
||
|
* }
|
||
|
*}
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
$domain = str_replace('autoconfig.', '', $_SERVER['HTTP_HOST']);
|
||
|
|
||
|
$default_domain = "mc8051.de";
|
||
|
$imap_server = 'mail.' . $default_domain;
|
||
|
$smtp_server = 'mail.' . $default_domain;
|
||
|
$pop3_server = 'mail.' . $default_domain;
|
||
|
|
||
|
$protocols = array(
|
||
|
'imaps',
|
||
|
'pop3s',
|
||
|
'smtps',
|
||
|
);
|
||
|
|
||
|
header('Content-Type: text/xml');
|
||
|
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
||
|
?>
|
||
|
<clientConfig version="1.1">
|
||
|
<emailProvider id="<?php echo $domain ?>">
|
||
|
<domain><?php echo $domain ?></domain>
|
||
|
<displayName><?php echo $domain ?> Mail</displayName>
|
||
|
<displayShortName><?php echo $domain ?></displayShortName>
|
||
|
<?php foreach($protocols as $protocol): ?>
|
||
|
<?php switch($protocol):
|
||
|
case 'imaps':
|
||
|
?>
|
||
|
<incomingServer type="imap">
|
||
|
<hostname><?php echo $imap_server ?></hostname>
|
||
|
<port>993</port>
|
||
|
<socketType>SSL</socketType>
|
||
|
<authentication>password-cleartext</authentication>
|
||
|
<username>%EMAILADDRESS%</username>
|
||
|
</incomingServer>
|
||
|
<?php
|
||
|
break;
|
||
|
case 'pop3s':
|
||
|
?>
|
||
|
<incomingServer type="pop3">
|
||
|
<hostname><?php echo $pop3_server ?></hostname>
|
||
|
<port>995</port>
|
||
|
<socketType>SSL</socketType>
|
||
|
<authentication>password-cleartext</authentication>
|
||
|
<username>%EMAILADDRESS%</username>
|
||
|
</incomingServer>
|
||
|
<?php
|
||
|
break;
|
||
|
case 'smtps':
|
||
|
?>
|
||
|
<outgoingServer type="smtp">
|
||
|
<hostname><?php echo $smtp_server ?></hostname>
|
||
|
<port>465</port>
|
||
|
<socketType>SSL</socketType>
|
||
|
<authentication>password-cleartext</authentication>
|
||
|
<username>%EMAILADDRESS%</username>
|
||
|
</outgoingServer>
|
||
|
<?php
|
||
|
break;
|
||
|
?>
|
||
|
<?php endswitch ?>
|
||
|
<?php endforeach ?>
|
||
|
</emailProvider>
|
||
|
</clientConfig>
|