2017-03-02 12:23:23 +02:00
< ? php
2018-10-11 11:59:23 +02:00
require_once $_SERVER [ 'DOCUMENT_ROOT' ] . '/inc/vars.inc.php' ;
2017-07-24 12:28:48 +02:00
$default_autodiscover_config = $autodiscover_config ;
if ( file_exists ( 'inc/vars.local.inc.php' )) {
include_once 'inc/vars.local.inc.php' ;
}
2017-09-16 13:33:27 +02:00
$autodiscover_config = array_merge ( $default_autodiscover_config , $autodiscover_config );
2017-07-24 12:28:48 +02:00
error_reporting ( 0 );
2017-05-16 19:20:58 +02:00
if ( empty ( $mailcow_hostname )) {
exit ();
}
2017-07-10 20:52:51 +02:00
$domain_dot = strpos ( $_SERVER [ 'HTTP_HOST' ], '.' );
$domain_port = strpos ( $_SERVER [ 'HTTP_HOST' ], ':' );
if ( $domain_port === FALSE ) {
$domain = substr ( $_SERVER [ 'HTTP_HOST' ], $domain_dot + 1 );
$port = 443 ;
2017-07-24 12:37:02 +02:00
}
else {
2017-07-10 20:52:51 +02:00
$domain = substr ( $_SERVER [ 'HTTP_HOST' ], $domain_dot + 1 , $domain_port - $domain_dot - 1 );
$port = substr ( $_SERVER [ 'HTTP_HOST' ], $domain_port + 1 );
}
2023-10-12 21:29:05 +02:00
if ( isset ( $_GET [ 'emailaddress' ])) {
2023-10-12 21:47:29 +02:00
$emailaddress_at = strpos ( $_GET [ 'emailaddress' ], '@' );
if ( $emailaddress_at !== FALSE ) {
$domain = substr ( $_GET [ 'emailaddress' ], $emailaddress_at + 1 );
}
2023-10-12 21:29:05 +02:00
}
2017-05-16 19:20:58 +02:00
header ( 'Content-Type: application/xml' );
2017-03-02 12:23:23 +02:00
?>
2017-05-16 19:20:58 +02:00
< ? = '<?xml version="1.0"?>' ; ?>
2017-03-02 12:23:23 +02:00
< clientConfig version = " 1.1 " >
2017-07-24 12:37:02 +02:00
< emailProvider id = " <?= $mailcow_hostname ; ?> " >
2017-03-22 14:35:49 +02:00
< domain >% EMAILDOMAIN %</ domain >
2017-03-02 12:23:23 +02:00
< displayName > A mailcow mail server </ displayName >
< displayShortName > mail server </ displayShortName >
< incomingServer type = " imap " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'imap' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'imap' ][ 'port' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > SSL </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ incomingServer >
< incomingServer type = " imap " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'imap' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'imap' ][ 'tlsport' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > STARTTLS </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ incomingServer >
2017-07-10 20:52:51 +02:00
< ? php
$records = dns_get_record ( '_pop3s._tcp.' . $domain , DNS_SRV ); // check if POP3 is announced as "not provided" via SRV record
2023-10-12 21:47:29 +02:00
if ( $records === FALSE || count ( $records ) == 0 || $records [ 0 ][ 'target' ] != '' ) { ?>
2017-03-02 12:23:23 +02:00
< incomingServer type = " pop3 " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'pop3' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'pop3' ][ 'port' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > SSL </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ incomingServer >
2017-07-10 20:52:51 +02:00
< ? php } ?>
< ? php
$records = dns_get_record ( '_pop3._tcp.' . $domain , DNS_SRV ); // check if POP3 is announced as "not provided" via SRV record
2023-10-12 21:47:29 +02:00
if ( $records === FALSE || count ( $records ) == 0 || $records [ 0 ][ 'target' ] != '' ) { ?>
2017-03-02 12:23:23 +02:00
< incomingServer type = " pop3 " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'pop3' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'pop3' ][ 'tlsport' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > STARTTLS </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ incomingServer >
2017-07-10 20:52:51 +02:00
< ? php } ?>
2017-03-02 12:23:23 +02:00
< outgoingServer type = " smtp " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'smtp' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'smtp' ][ 'port' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > SSL </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ outgoingServer >
< outgoingServer type = " smtp " >
2017-09-16 13:33:27 +02:00
< hostname >< ? = $autodiscover_config [ 'smtp' ][ 'server' ]; ?> </hostname>
< port >< ? = $autodiscover_config [ 'smtp' ][ 'tlsport' ]; ?> </port>
2017-03-02 12:23:23 +02:00
< socketType > STARTTLS </ socketType >
< username >% EMAILADDRESS %</ username >
< authentication > password - cleartext </ authentication >
</ outgoingServer >
2017-07-24 12:37:02 +02:00
< enable visiturl = " https://<?= $mailcow_hostname ; ?><?php if ( $port != 443) echo ':'. $port ; ?>/admin.php " >
2017-03-02 12:23:23 +02:00
< instruction > If you didn 't change the password given to you by the administrator or if you didn' t change it in a long time , please consider doing that now .</ instruction >
< instruction lang = " de " > Sollten Sie das Ihnen durch den Administrator vergebene Passwort noch nicht geändert haben , empfehlen wir dies nun zu tun . Auch ein altes Passwort sollte aus Sicherheitsgründen geändert werden .</ instruction >
</ enable >
</ emailProvider >
< webMail >
2017-07-24 12:37:02 +02:00
< loginPage url = " https://<?= $mailcow_hostname ; ?><?php if ( $port != 443) echo ':'. $port ; ?>/SOGo/ " />
2017-03-02 12:23:23 +02:00
</ webMail >
</ clientConfig >