Postfix on Ubuntu: autoconfig/autodiscovery Thunderbird and Outlook

vladimir simeonov
27/07/2011

Mozilla Thunderbird и Outlook поддържат autodiscovery/autoconfig за автоматично намиране настройките на сървъра. в този кратък пост ще обясня как да се настроят, така че без излишно усилие да можете да настройвате клиентите си да се закачат към вашия postfix mail server

за има на сървър съм използвал lordofdetah.net, подменете го със своят адрес.

никъде не се въвеждат пароли, променят се единствено полетата в bold

Thunderbird autoconfig:

source: https://wiki.mozilla.org/Thunderbird:Autoconfiguration

1. добавяте в DNS сървъра следния примерен запис:

autoconfig    IN   CNAME   mail.lordofdeath.net.

2. mkdir /var/www/mail

3. cd /var/www/mail/

4. editor config-v1.1.xml

<?xml version="1.0" encoding="UTF-8"?>

<clientConfig version="1.1">
  <emailProvider id="lordofdeath.net">
    <domain>lordofdeath.net</domain>
    <displayName>My Mail</displayName>
    <displayShortName>Mail</displayShortName>
    <incomingServer type="imap">
      <hostname>mail.lordofdeath.net</hostname>
      <port>993</port>
      <socketType>SSL</socketType>
      <authentication>password-encrypted</authentication>
      <username>%EMAILADDRESS%</username>
    </incomingServer>
    <incomingServer type="imap">
      <hostname>mail.lordofdeath.net</hostname>
      <port>143</port>
      <socketType>STARTTLS</socketType>
      <authentication>password-cleartext</authentication>
      <username>%EMAILADDRESS%</username>
    </incomingServer>
    <incomingServer type="pop3">
      <hostname>mail.lordofdeath.net</hostname>
      <port>995</port>
      <socketType>SSL</socketType>
      <authentication>password-cleartext</authentication>
      <username>%EMAILADDRESS%</username>
    </incomingServer>
    <incomingServer type="pop3">
      <hostname>mail.lordofdeath.net</hostname>
      <port>110</port>
      <socketType>STARTTLS</socketType>
      <authentication>password-cleartext</authentication>
      <username>%EMAILADDRESS%</username>
    </incomingServer>
    <outgoingServer type="smtp">
      <hostname>mail.lordofdeath.net</hostname>
      <port>465</port>
      <socketType>SSL</socketType>
      <authentication>password-cleartext</authentication>
      <username>%EMAILADDRESS%</username>
    </outgoingServer>
    <outgoingServer type="smtp">
      <hostname>mail.lordofdeath.net</hostname>
      <port>587</port>
      <socketType>STARTTLS</socketType>
      <authentication>password-cleartext</authentication>
      <username>%EMAILADDRESS%</username>
    </outgoingServer>
  </emailProvider>
</clientConfig>

5. ln -s config-v1.1.xml config-v1.xml

Outlook autodiscovery:

source: http://virer.net/info/ol-autodiscover/index.html

1. mkdir /var/www/autodiscover

2. editor /var/www/autodiscover/.htaccess

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ – [NC,L]

RewriteRule ^.*$ autodiscover.php [NC,L]

3. a2enmod rewrite

4. /etc/init.d/apache2 reload

5.  добавяте следния запис в DNS:

_autodiscover._tcp IN SRV 0 100 443 mail.lordofdeath.net.

ако нямате валиден сертификат за SSL, сменете 443 с 80

5.1 добавете и следният запис:

autodiscover IN A mail.lordofdeath.net.

6.  editor /var/www/autodiscover/autodiscover.php

<?php

//get raw POST data so we can extract the email address

$data = file_get_contents(“php://input”);

preg_match(“/\<EMailAddress\>(.*?)\<\/EMailAddress\>/”, $data, $matches);

//set Content-Type

header(“Content-Type: application/xml”);

?>

<?php echo ‘<?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.lordofdeath.net</Server>

<Port>995</Port>

<LoginName><?php echo $matches[1]; ?></LoginName>

<DomainRequired>off</DomainRequired>

<SPA>off</SPA>

<SSL>on</SSL>

<AuthRequired>on</AuthRequired>

<DomainRequired>off</DomainRequired>

</Protocol>

<Protocol>

<Type>IMAP</Type>

<Server>mail.lordofdeath.net</Server>

<Port>993</Port>

<DomainRequired>off</DomainRequired>

<LoginName><?php echo $matches[1]; ?></LoginName>

<SPA>off</SPA>

<SSL>on</SSL>

<AuthRequired>on</AuthRequired>

</Protocol>

<Protocol>

<Type>SMTP</Type>

<Server>mail.lordofdeath.net</Server>

<Port>465</Port>

<DomainRequired>off</DomainRequired>

<LoginName><?php echo $matches[1]; ?></LoginName>

<SPA>off</SPA>

<SSL>on</SSL>

<AuthRequired>on</AuthRequired>

<UsePOPAuth>on</UsePOPAuth>

<SMTPLast>on</SMTPLast>

</Protocol>

</Account>

</Response>

</Autodiscover>

За сега тестовете показаха успешно сработване с посочените настройки. Надавам се те да спестят излишно време на support техниците в разяснения..

* Outlook ще избере POP3 без да дава възможност за избор на потребителя. ако държите да ползвате IMAP, разместете Protocol секциите.

** Ако поставите IMAP преди POP3, UsePOPAuth няма да работи, ще трябва на ръка да се настрои Outgoing Server-> My server req. auth -> Use same as incoming