public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Trace
data/web/autoconfig.php
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
<?php
2
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.inc.php';
3
$default_autodiscover_config = $autodiscover_config;
4
if(file_exists('inc/vars.local.inc.php')) {
5
include_once 'inc/vars.local.inc.php';
6
}
7
$autodiscover_config = array_merge($default_autodiscover_config, $autodiscover_config);
9
error_reporting(0);
11
if (empty($mailcow_hostname)) {
12
exit();
13
}
15
$domain_dot = strpos($_SERVER['HTTP_HOST'], '.');
16
$domain_port = strpos($_SERVER['HTTP_HOST'], ':');
17
if ($domain_port === FALSE) {
18
$domain = substr($_SERVER['HTTP_HOST'], $domain_dot+1);
19
$port = 443;
20
}
21
else {
22
$domain = substr($_SERVER['HTTP_HOST'], $domain_dot+1, $domain_port-$domain_dot-1);
23
$port = substr($_SERVER['HTTP_HOST'], $domain_port+1);
24
}
26
header('Content-Type: application/xml');
27
?>
28
<?= '<?xml version="1.0"?>'; ?>
29
<clientConfig version="1.1">
30
<emailProvider id="<?=$mailcow_hostname; ?>">
31
<domain>%EMAILDOMAIN%</domain>
32
<displayName><?=$autodiscover_config['displayName']; ?></displayName>
33
<displayShortName><?=$autodiscover_config['displayShortName']; ?></displayShortName>
35
<incomingServer type="imap">
36
<hostname><?=$autodiscover_config['imap']['server']; ?></hostname>
37
<port><?=$autodiscover_config['imap']['port']; ?></port>
38
<socketType>SSL</socketType>
39
<username>%EMAILADDRESS%</username>
40
<authentication>password-cleartext</authentication>
41
</incomingServer>
42
<incomingServer type="imap">
43
<hostname><?=$autodiscover_config['imap']['server']; ?></hostname>
44
<port><?=$autodiscover_config['imap']['tlsport']; ?></port>
45
<socketType>STARTTLS</socketType>
46
<username>%EMAILADDRESS%</username>
47
<authentication>password-cleartext</authentication>
48
</incomingServer>
50
<?php
51
$records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
52
if (count($records) == 0 || $records[0]['target'] != '') { ?>
53
<incomingServer type="pop3">
54
<hostname><?=$autodiscover_config['pop3']['server']; ?></hostname>
55
<port><?=$autodiscover_config['pop3']['port']; ?></port>
56
<socketType>SSL</socketType>
57
<username>%EMAILADDRESS%</username>
58
<authentication>password-cleartext</authentication>
59
</incomingServer>
60
<?php } ?>
61
<?php
62
$records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
63
if (count($records) == 0 || $records[0]['target'] != '') { ?>
64
<incomingServer type="pop3">
65
<hostname><?=$autodiscover_config['pop3']['server']; ?></hostname>
66
<port><?=$autodiscover_config['pop3']['tlsport']; ?></port>
67
<socketType>STARTTLS</socketType>
68
<username>%EMAILADDRESS%</username>
69
<authentication>password-cleartext</authentication>
70
</incomingServer>
71
<?php } ?>
73
<outgoingServer type="smtp">
74
<hostname><?=$autodiscover_config['smtp']['server']; ?></hostname>
75
<port><?=$autodiscover_config['smtp']['port']; ?></port>
76
<socketType>SSL</socketType>
77
<username>%EMAILADDRESS%</username>
78
<authentication>password-cleartext</authentication>
79
</outgoingServer>
80
<outgoingServer type="smtp">
81
<hostname><?=$autodiscover_config['smtp']['server']; ?></hostname>
82
<port><?=$autodiscover_config['smtp']['tlsport']; ?></port>
83
<socketType>STARTTLS</socketType>
84
<username>%EMAILADDRESS%</username>
85
<authentication>password-cleartext</authentication>
86
</outgoingServer>
88
<enable visiturl="https://<?=$mailcow_hostname; ?><?php if ($port != 443) echo ':'.$port; ?>/admin">
89
<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>
90
<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>
91
</enable>
93
</emailProvider>
95
<webMail>
96
<loginPage url="https://<?=$mailcow_hostname; ?><?php if ($port != 443) echo ':'.$port; ?>/SOGo/" />
97
</webMail>
98
</clientConfig>