Autodiscovery for eM Client

It can be identified by its lack of user agent header. Through additional Protocol tags, it can also have CalDAV and CardDAV configured.
This commit is contained in:
Michael Kuron 2017-06-18 10:08:19 +02:00 committed by Michael Kuron
parent 7b1eb71216
commit 646957efee

View File

@ -33,6 +33,10 @@ if ($config['useEASforOutlook'] == 'no') {
}
}
if (!isset($_SERVER['HTTP_USER_AGENT']) || empty($_SERVER['HTTP_USER_AGENT'])) { // eM Client sends no user agent
$config['autodiscoverType'] = 'imap';
}
$dsn = "$database_type:host=$database_host;dbname=$database_name";
$opt = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
@ -94,6 +98,18 @@ if (!isset($_SERVER['PHP_AUTH_USER']) OR $as !== "user") {
<UsePOPAuth>on</UsePOPAuth>
<SMTPLast>off</SMTPLast>
</Protocol>
<Protocol>
<Type>CalDAV</Type>
<Server>https://<?php echo $mailcow_hostname; ?>/SOGo/dav/<?php echo $email; ?>/Calendar</Server>
<DomainRequired>off</DomainRequired>
<LoginName><?php echo $email; ?></LoginName>
</Protocol>
<Protocol>
<Type>CardDAV</Type>
<Server>https://<?php echo $mailcow_hostname; ?>/SOGo/dav/<?php echo $email; ?>/Contacts</Server>
<DomainRequired>off</DomainRequired>
<LoginName><?php echo $email; ?></LoginName>
</Protocol>
</Account>
</Response>
<?php