mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
22.41.2015 a456cceb195b5f15ed161b7337d02ff8656ae59b
opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/SMTPAccountStatusNotificationHandlerConfiguration.xml
@@ -23,7 +23,8 @@
  !
  !
  !      Copyright 2007-2008 Sun Microsystems, Inc.
  !      Portions Copyright 2011 ForgeRock AS
  !      Portions Copyright 2011-2015 ForgeRock AS
  !      Portions copyright 2015 Edan Idzerda
  ! -->
<adm:managed-object name="smtp-account-status-notification-handler"
  plural-name="smtp-account-status-notification-handlers"
@@ -144,6 +145,31 @@
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="send-email-as-html"
                mandatory="true" advanced="true">
    <adm:synopsis>
      Indicates whether an email notification message should be sent as HTML.
    </adm:synopsis>
    <adm:description>
      If this value is true, email notification messages are marked as text/html.
      Otherwise outgoing email messages are assumed to be plaintext and marked as text/plain.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>false</adm:value>
       </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:name>
           ds-cfg-send-email-as-html
        </ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="sender-address" mandatory="true">
    <adm:synopsis>
      Specifies the email address from which the message is sent.
@@ -185,7 +211,7 @@
  <adm:property name="message-template-file" mandatory="true"
    multi-valued="true">
    <adm:synopsis>
      Specifies the path to the file containing the message template
      Specifies the path to the file containing the message template
      to generate the email notification messages.
    </adm:synopsis>
    <adm:description>
opendj-server-legacy/resource/config/config.ldif
@@ -22,6 +22,7 @@
#      Copyright 2006-2010 Sun Microsystems, Inc.
#      Portions Copyright 2012-2014 Manuel Gaupp
#      Portions Copyright 2010-2015 ForgeRock AS.
#      Portions copyright 2015 Edan Idzerda
#
#
# This file contains the primary Directory Server configuration.  It must not
@@ -143,6 +144,7 @@
ds-cfg-sender-address: opends-notifications@example.com
ds-cfg-email-address-attribute-type: mail
ds-cfg-send-message-without-end-user-address: false
ds-cdf-send-email-as-html: false
ds-cfg-message-template-file: account-temporarily-locked:config/messages/account-temporarily-locked.template
ds-cfg-message-template-file: account-permanently-locked:config/messages/account-permanently-locked.template
ds-cfg-message-template-file: account-unlocked:config/messages/account-unlocked.template
opendj-server-legacy/resource/schema/02-config.ldif
@@ -24,6 +24,7 @@
#      Portions Copyright 2010-2015 ForgeRock AS.
#      Portions Copyright 2011 profiq, s.r.o.
#      Portions Copyright 2012 Manuel Gaupp
#      Portions copyright 2015 Edan Idzerda
#
#
# This file contains the attribute type and objectclass definitions for use
@@ -3799,6 +3800,12 @@
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDJ Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.36733.2.1.1.148
  NAME 'ds-cfg-send-email-as-html'
  EQUALITY booleanMatch
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
  SINGLE-VALUE
  X-ORIGIN 'OpenDJ Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
  NAME 'ds-cfg-access-control-handler'
  SUP top
@@ -5067,7 +5074,8 @@
  STRUCTURAL
  MUST ( ds-cfg-sender-address $
         ds-cfg-send-message-without-end-user-address $
         ds-cfg-message-template-file )
         ds-cfg-message-template-file $
         ds-cfg-send-email-as-html )
  MAY ( ds-cfg-email-address-attribute-type $
        ds-cfg-recipient-address $
        ds-cfg-message-subject )
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -23,6 +23,7 @@
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014-2015 ForgeRock AS
 *      Portions copyright 2015 Edan Idzerda
 */
package org.opends.server.extensions;
@@ -622,6 +623,11 @@
    EMailMessage message = new EMailMessage(config.getSenderAddress(),
                                            recipients, subject);
    message.setBody(messageBody);
    if (config.isSendEmailAsHtml())
    {
      message.setBodyMIMEType("text/html");
    }
    if (logger.isTraceEnabled())
    {
      logger.trace("Set message body of " + messageBody);
opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
@@ -24,6 +24,7 @@
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2014-2015 ForgeRock AS
 *      Portions copyright 2015 Edan Idzerda
 */
package org.opends.server.util;
@@ -228,6 +229,25 @@
  }
  /**
   * Retrieves the MIME Type for the body of this message
   *
   * @return The MIME Type for this message
   */
   public String getBodyMIMEType()
   {
     return bodyMIMEType;
   }
  /**
   * Specifies the MIME Type for the body of this message
   *
   * @param bodyMIMEType  The MIME Type for this message
   */
  public void setBodyMIMEType(String bodyMIMEType)
  {
    this.bodyMIMEType = bodyMIMEType;
  }
  /**
   * Retrieves the body for this message.  It may be directly manipulated by the
@@ -431,7 +451,7 @@
      // multipart.  Otherwise, just set the text of the message.
      if (attachments.isEmpty())
      {
        message.setText(body.toString());
        message.setContent(body.toString(), bodyMIMEType);
      }
      else
      {