Automatisches einrichten Outlook (autodiscover) Thunderbird (autoconfig)

Hinweis: Wir haben in diesem Artikel möglicherweise Provisions-Links verwendet und sie durch (*) gekennzeichnet. Erfolgt über diese Links eine Bestellung, erhält maffert.net eine Provision. Es entstehen für Sie keine Nachteile beim Kauf oder Preis.

Thunderbird und Microsoft Outlook bieten die Möglichkeit an, E-Mail Adressen fast automatisch einzurichten bzw. zu konfigurieren. Hierbei wird auf dem eigenen Server eine Konfigurationsdatei hinterlegt (mit allen benötigten Daten), welche von Thunderbird und Outlook beim Einrichten des E-Mail-Kontos ausgelesen und verarbeitet wird.

In meinem Beispielen gehe ich davon aus, das meine Domain „meinedomain.de“ lautet und die Dateien und Ordner unter „/var/www/automail.meinedomain.de“ zu finden sind.


Thunderbird:

Thunderbird geht nach folgender Reihenfolge vor um an die benötigten Server Informationen zu kommen:

  1. tb-install-dir/isp/example.com.xml on the harddisk
  2. check for autoconfig.example.com
  3. look up of „example.com“ in the ISPDB
  4. look up „MX example.com“ in DNS, and for mx1.mail.hoster.com, look up „hoster.com“ in the ISPDB
  5. try to guess (imap.example.com, smtp.example.com etc.)

Neue vHost Datei mit folgendem Inhalt erstellen:

<VirtualHost 1.2.3.4:80>
DocumentRoot /var/www/automail.meinedomain.de/
ServerName autoconfig.meinedomain.de
<Directory /var/www/automail.meinedomain.de>
Order allow,deny
allow from all
</Directory>
</VirtualHost>

den Ordner „mail“ und die Datei „config-v1.1.xml“ erstellen:

mkdir /var/www/automail.meinedomain.de/mail
cd /var/www/automail.meinedomain.de/mail
touch config-v1.1.xml

Beispiel Konfiguration einer „config-v1.1.xml“ Datei:

<clientConfig version="1.1">
<emailProvider id="meinedomain.de">
<domain>meinedomain.de</domain>
<domain>meinedomain.net</domain>
<domain>meinedomain2.de</domain>
<domain>meinedomain3.de</domain>
<displayName>MeineDomain Mail</displayName>
<displayShortName>MeineDomain</displayShortName>
<incomingServer type="imap">
<hostname>imap.meinedomain.de</hostname>
<port>993</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<incomingServer type="imap">
<hostname>imap.meinedomain.de</hostname>
<port>143</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<incomingServer type="pop3">
<hostname>pop.maffert.net</hostname>
<port>995</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<incomingServer type="pop3">
<hostname>pop.maffert.net</hostname>
<port>110</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</incomingServer>
<outgoingServer type="smtp">
<hostname>smtp.meinedomain.de</hostname>
<port>465</port>
<socketType>SSL</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</outgoingServer>
<outgoingServer type="smtp">
<hostname>smtp.meinedomain.de</hostname>
<port>25</port>
<socketType>STARTTLS</socketType>
<authentication>password-cleartext</authentication>
<username>%EMAILADDRESS%</username>
</outgoingServer>
<documentation url="http://www.meinedomain.de/email_einrichtung.html">
<descr lang="de">Generic settings page</descr>
</documentation>
</emailProvider>
</clientConfig>

Links:
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration
https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Autoconfiguration/FileFormat/HowTo


Microsoft Outlook:

Outlook setzt eine sichere SSL Verbindung (https) zwingend vorraus. Man könnte zwar seine Zertifikate selber erstellen, aber dann zeigt Outlook beim suchen der Einstellungen ein Zertifikatsmeldung an. Möchte man dies umgehen, kann man entweder ein kostenloses (für Privat) Zertifikat von startssl nehmen oder ein kostenpflichtiges bei z.B. StartSSL oder Comodo usw. kaufen.

Zu der Einrichtung gibt es 2 Methoden. Einmal via PHP-Script (Methode1) und zu einem via echter .xml Datei (Methode2). Leider gibt es bei Methode2 Probleme bezüglich des Anmelder/Benutzer/Login Namens. Besteht dieser aus der kompletten E-Mail Adresse und nicht nur das was vor @ steht, muss z.B. ein PHP Script eingesetzt werden, das die E-Mail Adresse abfängt und passend einsetzt (Methode1) Wer sich nur mit dem Benutzername einloggt, kann auch Methode2 benutzen.

Methode 1 (PHP-Script > Empfohlen)

Ein sehr schönes PHP-Script gibt es von David Ramsden und als Ergänzung bezüglich des E-Mail Adressen abfanges von Sebastian van de Meer. Auch ich habe das Script noch ein wenig (POP3 und SMTP über Submission StartTLS )ergänzt.

Eine vHost Datei wie folgt erstellen:

<VirtualHost 1.2.3.4:443>
ServerName autodiscover.meinedomain.de
ServerAdmin webmaster@meinedomain.de

SSLEngine on
SSLCertificateFile      /etc/apache/ssl/certs/apache.domain.com.crt
SSLCertificateKeyFile   /etc/apache/ssl/private/apache.domain.com.key

# Force all requests to lowercase. Different MUAs, mobile devices etc
# request the Autodiscover URL in different cases.
RewriteEngine On
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

DocumentRoot /var/www/automail.meinedomain.de
<Directory />
Options +FollowSymLinks -Indexes
AllowOverride Options Indexes Limit FileInfo AuthConfig
</Directory>

Alias /autodiscover/autodiscover.xml /var/www/automail.meinedomain.de/autodiscover.php

ErrorLog /var/log/apache2/autodiscover_error.log
CustomLog /var/log/apache2/autodiscover_access.log combined
</VirtualHost>

nun wird unter „/var/www/automail.meinedomain.de“ die Datei „autodiscover.php“ mit folgendem Inhalt erstellt:

<?
/*
 Open Source Autodiscover implementation in PHP.

 Version: 1.0
 Tested with:
    - Microsoft Exchange Remote Connectivity Analyzer (1.3)
    - iOS 4.3.5
    - Outlook 2010 (SP0)
    - Android 2.3.3

 Allows auto configuration of ActiveSync and Outlook (or any other MUA that has
 autodiscover support).

 Example Apache vhost configuration (SSL is required for Autodiscover):

    <VirtualHost 1.2.3.4:443>
            ServerName autodiscover.domain.com
            ServerAdmin webmaster@domain.com

            SSLEngine on
            SSLCertificateFile      /etc/apache/ssl/certs/apache.domain.com.crt
            SSLCertificateKeyFile   /etc/apache/ssl/private/apache.domain.com.key

        # Force all requests to lowercase. Different MUAs, mobile devices etc
        # request the Autodiscover URL in different cases.
            RewriteEngine On
                RewriteMap lc int:tolower
            RewriteCond %{REQUEST_URI} [A-Z]
            RewriteRule (.*) ${lc:$1} [R=301,L]

            DocumentRoot /var/www/autodiscover/htdocs
            <Directory />
                    Options +FollowSymLinks -Indexes
                       AllowOverride Options Indexes Limit FileInfo AuthConfig
            </Directory>

                Alias /autodiscover/autodiscover.xml /var/www/autodiscover/htdocs/autodiscover.php

            ErrorLog /var/www/autodiscover/logs/error.log
               CustomLog /var/www/autodiscover/logs/access.log combined
    </VirtualHost>

------------------------------------------------------------------------------
  Copyright (C) 2011 David Ramsden

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

  David Ramsden david {at} 0wned {dot} it
------------------------------------------------------------------------------
*/
// For other supported protocols and more protocol settings, see:
//  http://technet.microsoft.com/en-us/library/cc511507.aspx

// Get contents of request made to Autodiscover.
$request = file_get_contents("php://input");
preg_match("/\<EMailAddress\>(.*?)\<\/EMailAddress\>/", $request, $email_address);

/*** Begin Configuration ***/
// ActiveSync URL.
$_CONFIG['MobileSync']['Url'] = "https://www.maffert.net/Microsoft-Server-ActiveSync";

// IMAP configuration settings.
$_CONFIG['IMAP']['Server'] = "imap.meinedomain.de";
$_CONFIG['IMAP']['Port'] = "993";
$_CONFIG['IMAP']['SSL'] = "on";
$_CONFIG['IMAP']['SPA'] = "off";
$_CONFIG['IMAP']['AuthRequired'] = "on";
$_CONFIG['IMAP']['LoginName'] = $email_address[1];

// POP3 configuration settings.
$_CONFIG['POP3']['Server'] = "pop.meinedomain.de";
$_CONFIG['POP3']['Port'] = "995";
$_CONFIG['POP3']['SSL'] = "on";
$_CONFIG['POP3']['SPA'] = "off";
$_CONFIG['POP3']['AuthRequired'] = "on";
$_CONFIG['POP3']['LoginName'] = $email_address[1];

// SMTP configuration settings.
$_CONFIG['SMTP']['Server'] = "smtp.meinedomain.de";
$_CONFIG['SMTP']['Port'] = "465";
$_CONFIG['SMTP']['SSL'] = "on";
$_CONFIG['SMTP']['SPA'] = "off";
$_CONFIG['SMTP']['AuthRequired'] = "on";
$_CONFIG['SMTP']['LoginName'] = $email_address[1];

// SMTP submission starttls configuration settings.
//$_CONFIG['SMTP']['Server'] = "smtp.meinedomain.de";
//$_CONFIG['SMTP']['Port'] = "587";
//$_CONFIG['SMTP']['Encryption'] = "TLS";
//$_CONFIG['SMTP']['SPA'] = "off";
//$_CONFIG['SMTP']['AuthRequired'] = "on";
//$_CONFIG['SMTP']['LoginName'] = $email_address[1];
/*** End Configuration ***/

// XML document heading.
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";

// Get the schema from the request.
preg_match("/\<AcceptableResponseSchema\>(.*?)\<\/AcceptableResponseSchema\>/", $request, $schema);
// Determine the type of device requesting Autodiscover.
if (preg_match("/\/mobilesync\//", $schema[1]))
{
    // Mobile device.
    preg_match("/\<EMailAddress\>(.*?)\<\/EMailAddress\>/", $request, $email_address);
    ?>
        <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
            <Response xmlns="<? echo $schema[1]; ?>">
                <Culture>en:en</Culture>
                <User>
                    <DisplayName><? echo $email_address[1]; ?></DisplayName>
                    <EMailAddress><? echo $email_address[1]; ?></EMailAddress>
                </User>
                <Action>
                    <Settings>
                        <Server>
                            <Type>MobileSync</Type>
                            <Url><? echo $_CONFIG['MobileSync']['Url']; ?></Url>
                            <Name><? echo $_CONFIG['MobileSync']['Url']; ?></Name>
                        </Server>
                    </Settings>
                </Action>
            </Response>
        </Autodiscover>
    <?
}
else if (preg_match("/\/outlook\//", $schema[1]))
{
    // MUA (mail client).
    ?>
        <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
            <Response xmlns="<? echo $schema[1]; ?>">
                <Account>
                    <AccountType>email</AccountType>
                    <Action>settings</Action>
                <?
                    // Loop through each configured protocol.
                    while(list($protocol, $settings) = each($_CONFIG))
                    {
                        // Skip ActiveSync protocol.
                        if ($protocol == "MobileSync") continue;
                    ?>
                        <Protocol>
                            <Type><? echo $protocol; ?></Type>
                    <?
                        // Loop through each setting for this protocol.
                        while(list($setting, $value) = each($settings))
                        {
                            echo "\t\t\t\t\t\t\t<$setting>$value</$setting>\n";
                        }
                    ?>
                        </Protocol>
                    <?
                    }
                ?>
                </Account>
            </Response>
        </Autodiscover>
    <?
}
else
{
    // Unknown.
    list($usec, $sec) = explode(' ', microtime());
    ?>
        <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
            <Response>
                <Error Time="<? echo date('H:i:s', $sec) . substr($usec, 0, strlen($usec) - 2); ?>" Id="2477272013">
                    <ErrorCode>600</ErrorCode>
                    <Message>Invalid Request</Message>
                    <DebugData />
                </Error>
            </Response>
        </Autodiscover>
    <?
}
?>

 

Benutzt man SSL muss folgendes ergänzt werden:

<SSL>on</SSL>

 

bei TLS:

<Encryption>TLS</Encryption>

Möchte man nun die Thunderbird vHost und Outlook vHost Datei zusammenlegen, kann man folgende vHost benutzen:

<VirtualHost 1.2.3.4:80>
    DocumentRoot /var/www/automail.meinedomain.de/
    ServerName autoconfig.meinedomain.de
    <Directory /var/www/automail.meinedomain.de>
        Order allow,deny
        allow from all
    </Directory>

  ErrorLog /var/log/apache2/autoconfig_error.log
  CustomLog /var/log/apache2/autoconfig_access.log combined

</VirtualHost>

<VirtualHost 1.2.3.4:443>
ServerName autodiscover.meinedomain.de
ServerAdmin webmaster@meinedomain.de

SSLEngine on
SSLCertificateFile      /etc/apache/ssl/certs/apache.domain.com.crt
SSLCertificateKeyFile   /etc/apache/ssl/private/apache.domain.com.key

# Force all requests to lowercase. Different MUAs, mobile devices etc
# request the Autodiscover URL in different cases.
RewriteEngine On
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

DocumentRoot /var/www/automail.meinedomain.de
<Directory />
Options +FollowSymLinks -Indexes
AllowOverride Options Indexes Limit FileInfo AuthConfig
</Directory>

Alias /autodiscover/autodiscover.xml /var/www/automail.meinedomain.de/autodiscover.php

ErrorLog /var/log/apache2/autodiscover_error.log
CustomLog /var/log/apache2/autodiscover_access.log combined
</VirtualHost>

Methode 2 (Datei > nicht unbedingt Empfohlen)

Neue vHost Datei mit folgendem Inhalt erstellen:

<VirtualHost IPZUMSERVER:80>
DocumentRoot /var/www/automail.meinedomain.de/
ServerName autodiscover.meinedomain.de
<Directory /var/www/automail.meinedomain.de>
Order allow,deny
allow from all
</Directory>
</VirtualHost>

den Ordner „autodiscover“ und die Datei „autodiscover.xml“ erstellen:

mkdir /var/www/automail.meinedomain.de/autodiscover
cd /var/www/automail.meinedomain.de/autodiscover
touch autodiscover.xml

Beispiel Konfiguration einer „autodiscover.xml“ Datei:

<?xml version="1.0" encoding="utf-8" ?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
<Account>
<AccountType>email</AccountType>
<Action>settings</Action>
<Protocol>
<Type>POP3</Type>
<Server>mail.maffert.net</Server>
<Port>995</Port>
<DomainName></DomainName>
<DomainRequired>off</DomainRequired>
<SPA>off</SPA>
<SSL>on</SSL>
<AuthRequired>on</AuthRequired>
</Protocol>
<Protocol>
<Type>IMAP</Type>
<Server>mail.maffert.net</Server>
<Port>993</Port>
<DomainRequired>off</DomainRequired>
<SPA>off</SPA>
<SSL>on</SSL>
<AuthRequired>on</AuthRequired>
</Protocol>
<Protocol>
<Type>SMTP</Type>
<Server>mail.maffert.net</Server>
<Port>587</Port>
<DomainRequired>off</DomainRequired>
<SPA>off</SPA>
<Encryption>TLS</Encryption>
<AuthRequired>on</AuthRequired>
<UsePOPAuth>on</UsePOPAuth>
<SMTPLast>off</SMTPLast>
</Protocol>
</Account>
</Response>
</Autodiscover>

Benutzt man SSL muss folgendes ergänzt werden:

<SSL>on</SSL>

bei TLS:

<Encryption>TLS</Encryption>

Möchte man alles in einer vHost haben und alle Dateien in einem Ordner, dann könnte man die vHost Datei wie folgt aussehen lassen:

<VirtualHost IPZUMSERVER:80>
DocumentRoot /var/www/automail.meinedomain.de/
ServerName autodiscover.meinedomain.de
ServerAlias autoconfig.meinedomain.de
<Directory /var/www/automail.meinedomain.de>
Order allow,deny
allow from all
</Directory>
</VirtualHost>

In dem Fall ist der Ordner „/var/www/automail.meinedomain.de/“ der, wo alle Dateien liegen!

 

Einstellungen überprüfen:

  • Mit dem Outlook Client: STRG gedrückt halten + rechte Maustaste auf das Outlook Symbol in der Leiste neben der Uhr > „E-Mail-AutoKonfiguration testen …“ auswählen.
  • Mit der Webseite „https://testconnectivity.microsoft.com“ von Microsoft: https://testconnectivity.microsoft.com
    Hier wird man feststellen, das die überprüfung mit Methode 1 Fehlschlägt, da u.a. nach https://autodiscover.maffert.net/Autodiscover/Autodiscover.xml gesucht wird. Der genaue Augenmerk liegt hier bei auf das große A! Erstellt man also den Ordner mit einem großen A und und die Datei ebenfalls, wird man merken das der Check plötzlich erfolgreich durchläuft! Microsoft halt … 😉

Ein Kommentar zu “Automatisches einrichten Outlook (autodiscover) Thunderbird (autoconfig)”

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert