注釈

スマートホストとリレーホストという用語は、通常同じ意味で使用されます。ここでは、スマートホストという用語を使用します。

概要

You can configure a server-wide smarthost in Plesk Obsidian 18.0.64 or later. You can configure a smarthost at the domain level in Plesk Obsidian 18.0.76 or later.

このトピックでは、以下の内容を学習します。

  • スマートホストの使用が有益なのはどのような場合か。

  • Plesk でスマートホストを構成する方法。

  • スマートホストを構成すると、既存の手動構成にどのように影響するか。

  • スマートホストをセットアップするときに Plesk がメールサービスの構成ファイルを変更する方法。

You can send emails from Plesk using its local SMTP server. However, some hosting providers block outgoing mail from local SMTP servers. Even when they allow it, email deliverability may be poor and messages can end up in spam. To avoid these issues, configure a smarthost.

A smarthost is a mail server that accepts messages from any sender and forwards them to their final destination. A smarthost acts as an intermediary to improve email deliverability and reduce the chances of messages being marked as spam.

When you send an email through a smarthost, the message appears to originate from the smarthost’s IP address. If the smarthost has a strong sending reputation, your email is more likely to reach the recipient’s inbox instead of being marked as spam. For this reason, we recommend using a reputable SMTP relay service as your smarthost (for example, SendGrid, Mailgun, Mailjet, or similar providers).

Previously, you could configure a smarthost only manually. In Plesk Obsidian 18.0.64 and later, you can configure a smarthost in the Plesk graphical interface and via the CLI.

Configuring a Server-Wide Smarthost

You can configure a smarthost for the whole server. This works in Plesk for Linux with Postfix and Plesk for Windows with either MailEnable or SmarterMail.

注意

スマートホストを手動で構成済みの場合は、Plesk でスマートホスト機能を有効にすると、既存の構成が上書きされます。機能を有効にする前に、まず 次のセクションを参照する ことをお勧めします。

注釈

一部の SMTP リレーサービス (SendGrid など) では、スマートホストを構成すると メール転送 が機能しなくなります。

To configure a server-wide smarthost:

  1. Choose a reputable SMTP relay service (for example, SendGrid, Mailgun, Mailjet, or similar providers) and create an account there.

  2. Plesk にログインします

  3. [ツールと設定] > [スマートホスト] ([メール] の下) に移動します。

  4. [ユーザのメールをスマートホスト経由で送信] チェックボックスをオンにします。

  5. 対応するフィールドに、スマートホストの IP アドレスまたはホスト名を指定します (たとえば 192.0.2.1 または smtp.sendgrid.net)。

    注釈

    Plesk for Linux では、ホスト名または IP アドレスを角括弧で囲むことで、MX または SRV ルックアップを無効にすることができます (例: [example.com])。詳細については、 Postfix ドキュメント (relayhost に関するセクション) を参照してください。

  6. SMTP リレーサービスで SMTP 認証が必要な場合 (ほとんどのサービスで必要です)、[認証が必要] チェックボックスをオンにします。

  7. 前の手順で [認証が必要] をオンにした場合は、SMTP リレーサービスの認証用のログイン情報を指定します。

    サービスが基本認証をサポートしている場合は、対応するフィールドにユーザ名とパスワードを指定します。サービスが API キーによる認証をサポートしている場合は、[ユーザ名] フィールドにサービス内の API キーに使用されるデフォルトのユーザ名 (たとえば SendGrid の場合、ユーザ名は apikey) を指定し、[パスワード] フィールドに API キーの値を指定します。

  8. (For SmarterMail only) In the "Encrypted connection" section, select whether to encrypt the credentials transmitted to the SMTP relay service. Choose if the encrypted connection is TLS, SSL, or not required.

    注釈

    If you choose a connection type that the SMTP relay service does not support (for example, SSL instead of TLS), the smarthost will refuse the connection.

  9. (オプション) スマートホストへの接続を確立できるかどうかを確認することもできます。これを行うには、 [接続を確認] をクリックします。

    If you selected “Encrypted connection” in the previous step, Plesk tests the connection not only for encryption but also for a valid SSL/TLS certificate. If the connection is encrypted but the SSL/TLS certificate is not trusted (for example, expired or self‑signed), the smarthost will refuse the connection.

  10. [OK]をクリックします。

  11. DNS テンプレートおよび既存ドメインの DNS ゾーン内の SPF およびその他の関連 DNS レコードを更新します。SMTP リレーサービスから、DNS にどのような変更を加えるべきかについて情報が提供されます。

    Plesk 側でスマートホストを構成しました。ただし、ほとんどの商用 SMTP リレーサービスでは、サービス側でのドメイン認証 (ドメイン検証とも呼ばれます) が必要です。次の SMTP リレーサービスでこれが必要です: SendGridMailjetMailgun

  12. SMTP リレーサービスのアカウントに移動し、Plesk でホストされているすべてのドメインを認証します。具体的な手順については、サービスのドキュメントを参照してください。

  13. 外部メールサービス (Gmail など) にテストメールを送信し、メールが受信トレイに届いたことを確認します。

Plesk と SMTP リレーサービスの両方でスマートホストを構成しました。現在、スマートホストが稼働しています。

Configuring Smarthost for a Domain

You can configure a smarthost for an individual domain. This works in Plesk for Linux with Postfix and Plesk for Windows with either MailEnable or SmarterMail.

To configure a smarthost for a domain:

  1. Choose a reputable SMTP relay service (for example, SendGrid, Mailgun, Mailjet, or similar providers) and create an account there.

  2. Plesk にログインします

  3. Go to Websites & Domains > [domain_name] > Mail > Smarthost.

  4. [ユーザのメールをスマートホスト経由で送信] チェックボックスをオンにします。

  5. 対応するフィールドに、スマートホストの IP アドレスまたはホスト名を指定します (たとえば 192.0.2.1 または smtp.sendgrid.net)。

    注釈

    Plesk for Linux では、ホスト名または IP アドレスを角括弧で囲むことで、MX または SRV ルックアップを無効にすることができます (例: [example.com])。詳細については、 Postfix ドキュメント (relayhost に関するセクション) を参照してください。

  6. SMTP リレーサービスで SMTP 認証が必要な場合 (ほとんどのサービスで必要です)、[認証が必要] チェックボックスをオンにします。

  7. 前の手順で [認証が必要] をオンにした場合は、SMTP リレーサービスの認証用のログイン情報を指定します。

    サービスが基本認証をサポートしている場合は、対応するフィールドにユーザ名とパスワードを指定します。サービスが API キーによる認証をサポートしている場合は、[ユーザ名] フィールドにサービス内の API キーに使用されるデフォルトのユーザ名 (たとえば SendGrid の場合、ユーザ名は apikey) を指定し、[パスワード] フィールドに API キーの値を指定します。

  8. (オプション) スマートホストへの接続を確立できるかどうかを確認することもできます。これを行うには、 [接続を確認] をクリックします。

  9. [OK]をクリックします。

  10. Update the SPF record in the DNS zone of the domain you configured. This ensures the SMTP relay service is authorized to send mail for this domain.

    Plesk 側でスマートホストを構成しました。ただし、ほとんどの商用 SMTP リレーサービスでは、サービス側でのドメイン認証 (ドメイン検証とも呼ばれます) が必要です。次の SMTP リレーサービスでこれが必要です: SendGridMailjetMailgun

  11. Go to your SMTP relay service account and authenticate the domain you just configured smarhost for in Plesk. For exact steps on how to do so, refer to the documentation of your service.

  12. 外部メールサービス (Gmail など) にテストメールを送信し、メールが受信トレイに届いたことを確認します。

Plesk と SMTP リレーサービスの両方でスマートホストを構成しました。現在、スマートホストが稼働しています。

If you want to check which domains have an active smarthost, go to Mail> Smarthosts.

image smarthost list

以前に手動構成した後でスマートホストを構成する

すでにスマートホストを手動で構成している場合は、Plesk でスマートホスト機能を有効にすると、既存の構成が上書きされます。Plesk はほとんどのスマートホストサービスに適した最も一般的な構成を適用しますが、スマートホストに合わせて構成を調整する必要がある場合があります。

すでにスマートホストを手動で構成している場合は、次のアルゴリズムをお勧めします。

  1. 両方のスマートホスト構成 (手動構成と Plesk の構成) を比較します。

  2. Plesk によって制御されるパラメータを手動構成から削除します。

  3. Plesk でカバーされていない追加のパラメータはそのままにしておきます。

  4. Plesk でスマートホスト機能を有効にします

両方の構成を比較できるように、以下ではスマートホスト機能が内部でどのように機能するか、つまりどの構成ファイルにどのような影響を与えるかについて説明します。

(Plesk for Linux) Postfix を使用したスマートホスト構成

注釈

Domain‑level smarthosts take priority over the server‑wide smarthost configured in Plesk.

When you enable the smarthost feature, Plesk performs a few actions under the hood.

For server-wide smarthost:

  1. Plesk adds lines of the following pattern to the /etc/postfix/main.cf configuration file:

    # Sets an external SMTP relayhost with a port number
    relayhost - [Your-SMTP-server-IP-or-hostname]:587
    # Turns on authentication
    smtp_sasl_auth_enable = yes
    # Sets the username and password required for authentication
    smtp_sasl_password_maps = /var/spool/postfix/plesk/relay_secrets
    # Prohibits anonymous authentication methods.
    smtp_sasl_security_options = noanonymous
    
  2. Plesk then checks that /etc/postfix/main.cf contains no duplicate directives, which can break the configuration:

    cat /etc/postfix/main.cf | grep -E "relayhost|smtp_sasl_auth_enable|smtp_sasl_password_maps|smtp_sasl_security_options"
    
  3. Plesk configures the API authentication to the SMTP relay service of your choice via the /etc/postfix/sasl_passwd file. For example, with the SendGrid service, the following line will be added:

    [smtp.sendgrid.net]:2525 apikey:<your-SendGrid-API-key-value>
    
  4. Finally, Plesk reloads the Postfix service to apply the changes:

    systemctl reload postfix
    

For a domain-specific smarthost:

  1. If no server-wide smarthost has been previously configured, Plesk adds the required baseline Postfix directives to the /etc/postfix/main.cf configuration file and also adds per-domain routing and credentials (no global relayhost is needed):

    # Turns on authentication
    smtp_sasl_auth_enable = yes
    # Sets the username and password required for authentication
    smtp_sasl_password_maps = hash:/var/spool/postfix/plesk/relay_secrets.db
    # Prohibits anonymous authentication methods.
    smtp_sasl_security_options = noanonymous
    # Enables per‑sender authentication and routing
    smtp_sender_dependent_authentication = yes
    # Maps sender addresses to specific relay hosts
    sender_dependent_relayhost_maps = hash:/var/spool/postfix/plesk/sender_relay.db
    
  2. Plesk then checks that /etc/postfix/main.cf contains no duplicate directives, which can break the configuration:

    cat /etc/postfix/main.cf | grep -E "smtp_sasl_auth_enable|smtp_sasl_password_maps|smtp_sasl_security_options|smtp_sender_dependent_authentication|sender_dependent_relayhost_maps"
    
  3. Plesck adds or updates the sender‑dependent mapping files used for domain‑level smarthosts

    • /var/spool/postfix/plesk/sender_relay.db — maps domains to their relay hosts.

    • /var/spool/postfix/plesk/relay_secrets.db — stores credentials for the corresponding relay hosts.

    For example, with the SendGrid service, Plesk writes entries similar to:

    # sender_relay
    admin@example.com    [smtp.sendgrid.net]:587
    
    # relay_secrets
    [smtp.sendgrid.net]:587    apikey:<your-SendGrid-API-key-value>
    
  4. Finally, Plesk reloads the Postfix service to apply the changes:

    systemctl reload postfix
    

(Plesk for Windows) MailEnable を使用したスマートホスト構成

スマートホスト機能を有効にすると、Plesk は以下のスクリーンショットに示す MailEnable 構成を適用します。たとえば、SendGrid SMTP リレーサービスを使用します。

最初のスクリーンショットはサーバ全体の構成を示しており、2 番目のスクリーンショットはドメインの構成を示しています。

image smarthost mailenable

image smarthost mailenable domain

注釈

Domain‑level smarthosts take priority over the server‑wide smarthost configured in Plesk.

(Plesk for Windows) SmarterMail を使用したスマートホスト構成

スマートホスト機能を有効にすると、Plesk は以下のスクリーンショットに示す SmarterMail 構成を適用します。たとえば、SendGrid SMTP リレーサービスを使用します。

最初のスクリーンショットはサーバ全体の構成を示しており、2 番目のスクリーンショットはドメインの構成を示しています。

image smarthost smartermail 1

image smarthost smartermail 2

注釈

Domain‑level smarthosts take priority over the server‑wide smarthost configured in Plesk.

スマートホスト機能を無効にする

Plesk グラフィカルインターフェースで非表示にすることによりスマートホスト機能を無効にすることもできます。

スマートホスト機能を無効にするには:

  1. panel.ini ファイルを編集用に開きます。ファイルは以下の場所にあります。

    • (Plesk for Linux) /usr/local/psa/admin/conf/panel.ini

    • (Plesk for Windows) %plesk_dir%admin\conf\panel.ini

    Panel.ini Editor 拡張を使用すると、Plesk インターフェースでもファイルを編集できます。

  2. To disable smarthost at the server level, add the following lines to the panel.ini file, and then save it:

    [mail]
    smarthost.server.enabled = false
    

スマートホスト機能は [ツールと設定] に表示されなくなります。

  1. To disable smarthost at the domain level, add the following lines to the panel.ini file, and then save it:

    [mail]
    smarthost.domain.enabled = false
    

The smarthost feature is no longer shown in Websites & Domains > [domain_name] > Mail.

注釈

制限モード を有効にすることで、スマートホスト機能を無効にすることもできます。

[接続を確認] ボタンに紐付けられた SSL/TLS 証明書チェックを無効にする

By default, if the connection to a smarthost requires encryption, clicking Check Connection also verifies whether the connection uses a valid SSL/TLS certificate. If the certificate is invalid or missing, the smarthost will refuse the connection.

SSL/TLS 証明書が信頼できるものではない場合でも (期限切れや自己署名など) 接続を確立したい場合は、証明書のチェックを無効にすることができます。

[接続を確認] ボタンに紐付けられた SSL/TLS 証明書チェックを無効にするには:

  1. panel.ini ファイルを編集用に開きます。ファイルは以下の場所にあります。

    • (Plesk for Linux) /usr/local/psa/admin/conf/panel.ini

    • (Plesk for Windows) %plesk_dir%admin\conf\panel.ini

    Panel.ini Editor 拡張を使用すると、Plesk インターフェースでもファイルを編集できます。

  2. For disabling the check of the certificate at server level, add the following lines to the panel.ini file, and then save it:

    [mail]
    smarthost.server.checkConnection.checkCertificate = false
    
  3. For disabling the check of the certificate at domain level, add the following lines to the panel.ini file, and then save it:

    [mail]
    smarthost.domain.checkConnection.checkCertificate = false
    

有効な SSL/TLS 証明書で保護されていないスマートホストとの接続を確立できるようになります。