LoginSignup
4
1

More than 3 years have passed since last update.

メーラの自動設定ファイルを配布する

Last updated at Posted at 2019-11-22

概要

情報系センターで働いていると、利用者サポートコストを軽減するため、各種の自動設定ファイルを配布する必要に迫られる。今回は、メールシステムの移転に伴い、メーラの自動設定ファイルの配布が必要になったので、方法を調査した。

Thunderbird

Thunderbird については、公式の解説ページの通りに作業すれば良い。以下のような内容の XML ファイルを、http://autoconfig.example.jp/mail/config-v1.1.xml でアクセスできるように用意した。

config-v1.1.xml
<?xml version="1.0" encoding="UTF-8"?>
<clientConfig version="1.1">
  <emailProvider id="example.jp">
    <domain>example.jp</domain>
    <displayName>Example Mail System</displayName>
    <displayShortName>ExMail</displayShortName>
    <incomingServer type="imap">
      <hostname>imap.gmail.com</hostname>
      <port>993</port>
      <socketType>SSL</socketType>
      <username>%EMAILADDRESS%</username>
      <authentication>OAuth2</authentication>
      <authentication>password-cleartext</authentication>
    </incomingServer>
    <incomingServer type="pop3">
      <hostname>pop.gmail.com</hostname>
      <port>995</port>
      <socketType>SSL</socketType>
      <username>%EMAILADDRESS%</username>
      <authentication>OAuth2</authentication>
      <authentication>password-cleartext</authentication>
    </incomingServer>
    <outgoingServer type="smtp">
      <hostname>smtp.gmail.com</hostname>
      <port>465</port>
      <socketType>SSL</socketType>
      <username>%EMAILADDRESS%</username>
      <authentication>OAuth2</authentication>
      <authentication>password-cleartext</authentication>
    </outgoingServer>
    <documentation url="http://example.jp/mail/">
      <descr lang="en">Generic information of ExMail</descr>
      <descr lang="ja">メールシステムの使い方</descr>
    </documentation>
    <documentation url="http://example.jp/mail/mua-config">
      <descr lang="en">IMAP/POP3 settings</descr>
      <descr lang="ja">IMAP または POP3 によるメールシステムの使い方</descr>
    </documentation>
  </emailProvider>
</clientConfig>

Outlook

Outlook については、調査したものの失敗した。

などの情報によれば,

  1. AD に登録された SCP (ServiceConnectionPoint) に設定された URL
  2. https://<ユーザーのメールアドレスのドメイン>/autodiscover/autodiscover.xml
  3. https://autodiscover.<ユーザーのメールアドレスのドメイン>/autodiscover/autodiscover.xml
  4. ローカルの XML ファイル
  5. http://autodiscover.<ユーザーのメールアドレスのドメイン>/autodiscover/autodiscover.xml へのリダイレクト
  6. _autodiscover._tcp.<ユーザーのメールアドレスのドメイン> の SRV レコード

という順序で自動設定ファイルの場所を探すらしい。そこでまず,以下のようなエントリを DNS のゾーンファイルに追加。

example-zone
_autodiscover._tcp  IN  SRV 0 1 443 www.example.jp.

この状態で、Outlook の設定を試みると、以下のように設定ファイルを探しにくる(つまり、DNS は参照している)ところまでは確認できた。

52.125.128.1 - - [27/Nov/2019:18:33:11 +0900] "GET /autodiscover/autodiscover.json?Email=alice%40example.jp&Protocol=ActiveSync&RedirectCount=1 HTTP/1.1" 302 5457 "-" "OutlookMobileCloudService-Autodetect/1.0.0" 18329:5dde42d7:12
52.125.128.1 - - [27/Nov/2019:18:33:12 +0900] "POST /autodiscover/autodiscover.xml HTTP/1.1" 302 5347 "-" "-" 18328:5dde42d8:2

しかし、この autodiscover.json のファイル形式が大問題。調査したが、先人もファイルフォーマットについての情報が見つからない!とあきらめている。ただ、ログを観察していると、autodiscover.json の取得に失敗した直後には、autodiscover.xml の取得が発生しているので、一応フォールバックは実装されているようだ。アクセス元(上記のログでは 52.125.128.1)も謎で、Outlook を設定している端末の IP アドレスではない。マイクロソフト社のサーバを経由しているのではないかと思われる。

なお、https://wiki.mozilla.org/Gaia/Email/Autoconfig は、メーラの自動設定に関する情報が網羅的に収集されていて大変参考になる。

追記

https://wiki.zimbra.com/wiki/Autodiscover の記述を参考に、マイクロソフト社のウェブツールを使ってテストしてみた。autodiscover を Autodiscover と先頭のみ小文字から大文字に修正すると、ウェブツールのテストはパスするようになったのだが、それでもやはり Outlook の自動設定は動作しない…

iOS / Apple Mail

https://github.com/Tiliq/autodiscover.xml の通りに設定すれば良いようだが、未検証。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1