以前に Thunderbird 向けのオートコンフィグを設定しましたが、iPhone のメール自動設定も行ったので、記録しておきます。
ディレクトリの準備
Thunderbird のオートコンフィグを /var/www/html/.well-known/autoconfig/mail に配置済みのため、今回は autoconfig の中に iphone というディレクトリを作成して配置することにします。
1 | # mkdir -p /var/www/html/.well-known/autoconfig/iphone |
※ご自身の環境に合わせて設置してください。
Content-Type の設定
また前回、アクセス制限のために .htaccess を設置しましたが、それを流用して Content-Type の設定を入れます。
1 2 3 4 5 6 7 | AddType application/x-apple-aspen-config .mobileconfig <RequireAny> Require all denied Require ip xxx.xxx.xxx.xxx Require ip yyy.yyy.yyy.yyy </RequireAny> |
構成プロファイルを作成
構成プロファイル(user@example.com.mobileconfig)を作成します。
1 | # vi /var/www/html/.well-known/autoconfig/iphone/user@example.com.mobileconfig |
メールサーバーの環境に合わせて編集します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>PayloadContent</key> <array> <dict> <key>EmailAccountType</key> <string>EmailTypeIMAP</string> <key>EmailAddress</key> <string>user@example.com</string> <key>IncomingMailServerHostName</key> <string>mail.example.com</string> <key>IncomingMailServerPortNumber</key> <integer>993</integer> <key>IncomingMailServerUseSSL</key> <true/> <key>IncomingMailServerUsername</key> <string>user@example.com</string> <key>IncomingMailServerAuthentication</key> <string>EmailAuthPassword</string> <!-- パスワードを手打ちする場合は不要 --> <key>IncomingPassword</key> <string>Password123</string> <key>OutgoingMailServerHostName</key> <string>mail.example.com</string> <key>OutgoingMailServerPortNumber</key> <!-- STARTTLS の場合は 587 --> <integer>465</integer> <key>OutgoingMailServerUseSSL</key> <true/> <key>OutgoingMailServerUsername</key> <string>user@example.com</string> <key>OutgoingMailServerAuthentication</key> <string>EmailAuthPassword</string> <key>OutgoingPasswordSameAsIncomingPassword</key> <true/> <key>PayloadIdentifier</key> <string>com.example.mymailpayload</string> <key>PayloadType</key> <string>com.apple.mail.managed</string> <key>PayloadUUID</key> <!-- uuidgen コマンドで生成した値 --> <string>AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE</string> <key>PayloadVersion</key> <integer>1</integer> </dict> </array> <key>PayloadType</key> <string>Configuration</string> <key>PayloadIdentifier</key> <!-- 複数の構成プロファイルを登録する場合、重複しない名前を付ける --> <string>com.example.myprofile</string> <key>PayloadUUID</key> <!-- uuidgen コマンドで生成した値 --> <string>FFFFFFFF-GGGG-HHHH-IIII-JJJJJJJJJJJJ</string> <key>PayloadVersion</key> <integer>1</integer> </dict> </plist> |
※UUID は uuidgen コマンドで生成して置き換えてください。

以上で設定は完了です。
QR コードの作成
iPhone から https://example.com/.well-known/autoconfig/iphone/user@example.com.mobileconfig にアクセスすれば、構成プロファイルをダウンロードできます。
打ち込むのが面倒なので QR コードを作成しました。

構成プロファイルのインストール
作成した QR コードを読み込んだところ、構成プロファイルをダウンロードできました。

「設定」アプリを開き、「iPhone の設定を完了する」を選択します。

プロファイルを「インストール」すれば、メールの設定は完了です。

まとめ
手動でメールの設定をする際に、STARTTLS(587)で認証を試みるため、SSL(465)の場合はタイムアウトするまで待たされていました。
構成プロファイルを使えば無駄な待ち時間もなく、スムーズに設定を行うことができます。


コメント