Email notifications from Confluence are duplicated using Microsoft Exchange Server

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

Duplicate emails are sent to people using remote Exchange servers; or mail stops being sent and are added to the Mail Queue. 

The following error might appear in the atlassian-confluence.log:

ERROR [NotificationSender:thread-2] [plugin.notifications.dispatcher.NotificationErrorRegistryImpl] addError Error sending notification to server '<Unknown>'(-1) for INDIVIDUAL task (resent 4 times): Error sending to individual '8a818228609ba3ef01509ecd16fb0669' on server 'System Mail'
NotificationException: javax.mail.MessagingException: Exception reading response;
  nested exception is:
	java.net.SocketTimeoutException: Read timed out
......

原因

Mail stops sending because the mail thread cannot connect to the server, and there is no timeout set.

回避策

Increase the SMTP Timeout

Increasing the SMTP Timeout will prevent Confluence from timing out too quickly and duplicating the messages. From How To Set the SMTP Timeout in Confluence:

ここをクリックして展開...

ソリューション

  1. Confluence を停止します。

  2. Back up your Confluence database

  3. Run the following query on the database: 

    SELECT * FROM BANDANA WHERE BANDANAKEY = 'atlassian.confluence.smtp.mail.accounts';
  4. Find the following in the BANDANAVALUE:

    <property name="mail.smtp.timeout" value="10000"/>

    および

    <property name="mail.smtp.connectiontimeout" value="10000"/>
  5. Use SQL's REPLACE function to increase the values
    EXAMPLE:

    UPDATE BANDANA
       SET BANDANAVALUE = replace(BANDANAVALUE,'<property name="mail.smtp.connectiontimeout" value="10000"/>','<property name="mail.smtp.connectiontimeout" value="20000"/>')
     WHERE BANDANAVALUE LIKE '%mail.smtp.connectiontimeout%';
    
    
    UPDATE BANDANA
       SET BANDANAVALUE = replace(BANDANAVALUE,'<property name="mail.smtp.timeout" value="10000"/>','<property name="mail.smtp.timeout" value="20000"/>')
     WHERE BANDANAVALUE LIKE '%mail.smtp.timeout%';


    For MS SQL the update statements are:

    UPDATE BANDANA
       SET BANDANAVALUE = CAST(REPLACE(CAST(BANDANAVALUE as nvarchar(max)),'<property name="mail.smtp.timeout" value="10000"/>','<property name="mail.smtp.timeout" value="20000"/>') as ntext) 
     WHERE BANDANAVALUE LIKE '%mail.smtp.connectiontimeout%';
    
    UPDATE BANDANA
       SET BANDANAVALUE = CAST(REPLACE(CAST(BANDANAVALUE as nvarchar(max)),'<property name="mail.smtp.connectiontimeout" value="10000"/>','<property name="mail.smtp.connectiontimeout" value="20000"/>') as ntext) 
     WHERE BANDANAVALUE LIKE '%mail.smtp.timeout%';
    

    Also note:  If email settings are updated, the settings will revert to the default.  You will need to reproduce these steps after the change has been made.

  6. Confluence を再起動します。

Switch to a JNDI Connector 

If a JNDI Connector is configured in Tomcat, there is no timeout value set and it defaults to -1 which is unlimited. This will prevent Confluence from timing out too quickly and duplicating the messages. From Connect Exchange Server To Confluence via JNDI:

ここをクリックして展開...

  1. Confluence を停止します。
  2. <confluence-install>\confluence\WEB-INF\lib 内の次のファイルを移動します (コピー不可)。→ <confluence-install>\lib:

    com.sun.activation_jakarta.activation-x.x.x.jar
    com.sun.mail_jakarta.mail-x.x.x.jar

    (x.x.x. は、インストールに含まれる jar ファイルのバージョン番号を表します)

    名前を変更した jar ファイルのバックアップを \confluence\WEB-INF\lib に残さないでください。ファイル名が異なる場合も、ディレクトリ内にある限り、ファイルは読み込まれます。

  3. <confluence-install>\conf\server.xml ファイルを編集し、Confluence <context> タグの末尾、</Context> の直前に以下を追加します。
    注: Synchrony コンテキスト パスを含む <context> タグではなく Confluence コンテキスト パスを含む <context> タグを編集します。

    <Resource name="mail/GmailSMTPServer"
        auth="Container"
        type="javax.mail.Session"
        mail.smtp.host="smtp.gmail.com"
        mail.smtp.port="465"
        mail.smtp.auth="true"
        mail.smtp.user="yourEmailAddress@gmail.com"
        password="yourPassword"
        mail.smtp.starttls.enable="true"
        mail.transport.protocol="smtps"
        mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
    />
    
  4. Confluence を再起動します。
  5. [管理] > [一般設定] > [メール サーバー] に移動します。

  6. [既存の設定の編集] または [新しい SMTP メール サーバーの追加] のいずれかを選択します。
  7. 必要に応じてサーバー設定を編集し、JNDI の場所を以下に設定します。

     java:comp/env/mail/GmailSMTPServer
    


    JNDI の場所は、大文字と小文字を区別し、server.xml に指定したリソース名と一致する必要があることに注意してください。

  8. 変更を保存し、テスト メールを送信します。

Last modified on Mar 9, 2021

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.