diff --git a/contrib/openldap/core-fd.schema b/contrib/openldap/core-fd.schema
index 42beec3c29e35d8dce6384bfbb73c00bce55e777..8bd590c37bc765e50cf58df8ea38572bd479d18a 100644
--- a/contrib/openldap/core-fd.schema
+++ b/contrib/openldap/core-fd.schema
@@ -127,6 +127,164 @@ attributetype ( 1.3.6.1.4.1.38414.90.1.5 NAME 'fdMacroUserReminder'
   SUBSTR caseIgnoreSubstringsMatch
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
 
+### Mail Template Related Attributes ###
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.1 NAME 'fdMailTemplateBody'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.2 NAME 'fdMailTemplateRDN'
+  DESC 'FusionDirectory - template Mail RDN'
+  EQUALITY caseExactIA5Match
+  SUBSTR caseExactIA5SubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
+  SINGLE-VALUE)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.3 NAME 'fdMTPasswordRecoveryMailSubject'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+  
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.4 NAME 'fdMTPasswordRecoveryMailBody'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.5 NAME 'fdMTPasswordRecoveryMail2Subject'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.6 NAME 'fdMTPasswordRecoveryMail2Body'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.8 NAME 'fdMailTemplateSignature'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.9 NAME 'fdMailTemplateAttachment'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.10 NAME 'fdMailTemplateReadReceipt'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.11 NAME 'fdMailTemplateSubject'
+  DESC 'FusionDirectory - template mail field'
+  EQUALITY octetStringMatch
+  SUBSTR caseIgnoreSubstringsMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.40)
+
+# Attributes for mail template user reminder
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.12 NAME 'fdMTUserReminderForwardAlert'
+  DESC 'FusionDirectory - Forward alerts to manager'
+  EQUALITY booleanMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.13 NAME 'fdMTUserReminderForwardConfirmation'
+  DESC 'FusionDirectory - Forward postpone confirmations to manager'
+  EQUALITY booleanMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.14 NAME 'fdMTUserReminderAlertSubject'
+  DESC 'Fusion Directory - User reminder alert email subject'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.15 NAME 'fdMTUserReminderAlertBody'
+  DESC 'Fusion Directory - User reminder alert email body'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.16 NAME 'fdMTUserReminderConfirmationSubject'
+  DESC 'Fusion Directory - User reminder confirmation email subject'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.17 NAME 'fdMTUserReminderConfirmationBody'
+  DESC 'Fusion Directory - User reminder confirmation email body'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.18 NAME 'fdMTUserReminderForwardPpolicyAlert'
+  DESC 'FusionDirectory - Forward ppolicy alerts to manager'
+  EQUALITY booleanMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.19 NAME 'fdMTUserReminderPpolicyAlertSubject'
+  DESC 'Fusion Directory - User reminder ppolicy alert email subject'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.20 NAME 'fdMTUserReminderPpolicyAlertBody'
+  DESC 'Fusion Directory - User reminder ppolicy alert email body'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.21 NAME 'fdMTUserReminderExpirationSubject'
+  DESC 'Fusion Directory - User reminder expired email subject'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.22 NAME 'fdMTUserReminderExpirationBody'
+  DESC 'Fusion Directory - User reminder expired email body'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.23 NAME 'fdMTUserReminderForwardExpiration'
+  DESC 'FusionDirectory - User reminder, forward expiration emails to manager'
+  EQUALITY booleanMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+  SINGLE-VALUE )
+
+# Attributes for mail template invitations
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.24 NAME 'fdMTInvitationEmailSubject'
+  DESC 'FusionDirectory - Email Subject - Invitations'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.25 NAME 'fdMTInvitationEmailContent'
+  DESC 'FusionDirectory - Email Content - Invitation'
+  EQUALITY caseExactMatch
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
+attributetype ( 1.3.6.1.4.1.38414.88.1.26 NAME 'fdMTInvitationReplyTo'
+  DESC 'FusionDirectory - Email Address - Whom to Reply to invitations'
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  SINGLE-VALUE )
+
 # Classes
 
 objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.4 NAME 'gosaDepartment' SUP top AUXILIARY
@@ -164,6 +322,7 @@ objectclass ( 1.3.6.1.4.1.38414.62.2.2 NAME 'fdSubscriptionInformation' SUP top
   DESC 'FusionDirectory - Information about current subscription'
   MUST ( cn )
   MAY ( uid $ fdSubscriptionStartDate $ fdSubscriptionEndDate $ fdSubscriptionType $ fdSubscriptionContractId $ fdSubscriptionName ))
+<<<<<<< HEAD
   
 # Classes Macros Related
 
@@ -173,3 +332,41 @@ objectclass ( 1.3.6.1.4.1.38414.90.2.1 NAME 'fdMacroConf'
   MUST ( cn )
   MAY ( fdMacroRDN $ fdMacroMail $ fdMacroInvitations $ fdMacroUserRecovery $ fdMacroUserReminder ) )
 
+=======
+
+### Mail Template Related Object Class ###
+
+objectclass (1.3.6.1.4.1.38414.88.2.1 NAME 'fdMailTemplate'
+  DESC 'FusionDirectory - template mail object'
+  MUST ( cn $ fdMailTemplateBody $ fdMailTemplateSubject )
+  MAY ( fdMailTemplateSignature $ fdMailTemplateReadReceipt $ fdMailTemplateAttachment  ) )
+
+objectclass (1.3.6.1.4.1.38414.88.2.2 NAME 'fdMailTemplateUserRecovery'
+  DESC 'FusionDirectory - template mail object Recovery'
+  SUP top AUXILIARY
+  MUST ( cn )
+  MAY ( fdMTPasswordRecoveryMailSubject $ fdMTPasswordRecoveryMailBody $ fdMTPasswordRecoveryMail2Subject $ fdMTPasswordRecoveryMail2Body) )
+
+objectclass ( 1.3.6.1.4.1.38414.88.2.3 NAME 'fdMailTemplateConf'
+  DESC 'FusionDirectory Mail Template Configuration'
+  SUP top AUXILIARY
+  MUST ( cn )
+  MAY ( fdMailTemplateRDN ) )
+
+objectclass ( 1.3.6.1.4.1.38414.88.2.4 NAME 'fdMailTemplateUserReminder'
+  DESC 'FusionDirectory mail template user-reminder'
+  SUP top AUXILIARY
+  MUST ( cn $ fdMTUserReminderForwardConfirmation $ fdMTUserReminderForwardAlert)
+  MAY (
+  fdMTUserReminderConfirmationSubject $ fdMTUserReminderConfirmationBody $
+  fdMTUserReminderAlertSubject        $ fdMTUserReminderAlertBody $
+  fdMTUserReminderPpolicyAlertSubject $ fdMTUserReminderPpolicyAlertBody $
+  fdMTUserReminderForwardPpolicyAlert $ fdMTUserReminderExpirationSubject $ 
+  fdMTUserReminderExpirationBody $ fdMTUserReminderForwardExpiration) )
+
+objectclass ( 1.3.6.1.4.1.38414.88.2.5 NAME 'fdMailTemplateInvitations'
+  DESC 'FusionDirectory mail template Invitations'
+  SUP top AUXILIARY
+  MUST ( cn $ fdMTInvitationEmailSubject $ fdMTInvitationEmailContent)
+  MAY ( fdMTInvitationReplyTo ) )
+>>>>>>> 6205-enhancement-mail-template-object-invitations
diff --git a/plugins/addons/mailtemplate/class_mailTemplate.inc b/plugins/addons/mailtemplate/class_mailTemplate.inc
new file mode 100644
index 0000000000000000000000000000000000000000..7010fddf40c6c70d4e67da8b3ba1aaddde4fed1e
--- /dev/null
+++ b/plugins/addons/mailtemplate/class_mailTemplate.inc
@@ -0,0 +1,88 @@
+<?php
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
+
+  Copyright (C) 2012-2022 FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+class mailTemplate extends simplePlugin
+{
+  var $displayHeader = FALSE;
+
+  public static function plInfo (): array
+  {
+    return [
+      'plShortName'   => _('Mail Template'),
+      'plDescription' => _('Mail Tempmlate'),
+      'plObjectClass' => ['fdMailTemplate'],
+      'plFilter'      => '(objectClass=fdMailTemplate)',
+      'plObjectType'  => ['mailTemplate' => [
+        'name'        => _('Mail Template'),
+        'ou'          => get_ou('mailTemplateRDN'),
+        'icon'        => 'geticon.php?context=applications&icon=dsa&size=16',
+      ]],
+      'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
+    ];
+  }
+
+  static function getAttributesInfo (): array
+  {
+    global $config;
+    return [
+      // Attributes are grouped by section
+      'mailTemplate' => [
+        'name'  => _('Mail Object'),
+        'attrs' => [
+        new StringAttribute(
+          _('Mail Template Name'), _('Mail Template Name'),
+          'cn', TRUE
+        ),
+        new StringAttribute(
+          _('Mail Subject'), _('Mail Subject'),
+          'fdMailTemplateSubject', TRUE
+        ),
+        new TextAreaAttribute(
+          _('Mail Template Body'), _('Text to be sent to recipient'),
+          'fdMailTemplateBody', TRUE
+        ),
+        new TextAreaAttribute(
+          _('Mail Signature'), _('Mail Signature'),
+          'fdMailTemplateSignature', FALSE
+        ),
+        new FileDownloadAttribute(
+          _('Attachment'), _('Import a file for this e-mail'),
+          'fdMailTemplateAttachment', FALSE, '', TRUE
+        ),
+        new BooleanAttribute(
+          _('Read Receipt'),
+          _('Read Receipt'),
+          'fdMailTemplateReadReceipt', FALSE
+        ),
+        ]
+      ],
+    ];
+  }
+
+
+  function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
+  {
+    global $config;
+    parent::__construct($dn, $object, $parent, $mainTab);
+
+  }
+
+}
diff --git a/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc b/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc
new file mode 100644
index 0000000000000000000000000000000000000000..f33c3fac7f2398d5c25a08288152ce771f32b39e
--- /dev/null
+++ b/plugins/addons/mailtemplate/class_mailTemplateInvitations.inc
@@ -0,0 +1,72 @@
+<?php
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org)
+
+  Copyright (C) 2018-2022 FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+class mailTemplateInvitations extends simplePlugin
+{
+  protected $displayHeader = TRUE;
+
+  static function plInfo (): array
+  {
+    return [
+      'plShortName'   => _('Mail Template Invitations'),
+      'plDescription' => _('Mail Template Invitations'),
+      'plIcon'        => 'geticon.php?context=applications&icon=supann&size=48',
+      'plSmallIcon'   => 'geticon.php?context=applications&icon=supann-status&size=16',
+      'plPriority'    => 33,
+      'plObjectClass' => ['fdMailTemplateInvitations'],
+      'plFilter'      => '(objectClass=fdMailTemplateInvitations)',
+      'plObjectType'  => ['mailTemplate'],
+      'plConflicts'   => ['mailTemplateUserReminder', 'mailTemplateUserRecovery'],
+      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
+    ];
+  }
+
+  static function getAttributesInfo (): array
+  {
+    return  [
+      'main' => [
+        'name'  => _('Invitation'),
+        'attrs' => [
+          new StringAttribute(
+            _('Email subject'), _('Subject of the email sent for this invitation'),
+            'fdMTInvitationEmailSubject', TRUE
+          ),
+          new TextAreaAttribute(
+            _('Email content'), _('Content of the email sent for this invitation'),
+            'fdMTInvitationEmailContent', TRUE,
+            'A default Email here - was previously fetched by default configuration - %token%'
+          ),
+         new StringAttribute(
+            _('Reply to'), _('Email address set as "Reply to" in the sent emails'),
+            'fdMTInvitationReplyTo', FALSE
+          ),
+        ]
+      ],
+    ];
+  }
+
+  function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
+  {
+    global $config;
+    parent::__construct($dn, $object, $parent, $mainTab);
+  }
+
+}
diff --git a/plugins/addons/mailtemplate/class_mailTemplateManagement.inc b/plugins/addons/mailtemplate/class_mailTemplateManagement.inc
new file mode 100644
index 0000000000000000000000000000000000000000..f211ee33e68752f8e80ee13fe67b105787ee904d
--- /dev/null
+++ b/plugins/addons/mailtemplate/class_mailTemplateManagement.inc
@@ -0,0 +1,159 @@
+<?php
+
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
+  Copyright (C) 2011-2022  FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+class mailTemplateManagement extends management
+{
+
+  public static $columns = [
+    ['ObjectTypeColumn', []],
+    ['LinkColumn',       ['attributes' => 'cn', 'label' => 'Template Name']],
+    ['ActionsColumn',    ['label' => 'Actions']],
+  ];
+
+  static function plInfo (): array
+  {
+    return [
+      'plShortName'   => _('Mail Template'),
+      'plTitle'       => _('Mail Template'),
+      'plDescription' => _('Manages mails templates'),
+      'plIcon'        => 'geticon.php?context=types&icon=user&size=48',
+      'plManages'     => ['mailTemplate'],
+      'plSection'     => 'conf',
+      'plPriority'    => 30,
+      'plProvidedAcls' => [],
+    ];
+  }
+
+  protected function configureActions ()
+  {
+    global $config;
+
+    $createMenu = [];
+
+    foreach ($this->objectTypes as $type) {
+      $infos  = objects::infos($type);
+      $img    = 'geticon.php?context=actions&icon=document-new&size=16';
+      if (isset($infos['icon'])) {
+        $img = $infos['icon'];
+      }
+      $createMenu[] = new Action(
+        'new_'.$type, $infos['name'], $img,
+        '0', 'newEntry',
+        [$infos['aclCategory'].'/'.$infos['mainTab'].'/c']
+      );
+    }
+
+    $this->registerAction(
+     new SubMenuAction(
+       'new', _('Create'), 'geticon.php?context=actions&icon=document-new&size=16',
+       $createMenu
+     )
+    );
+
+    // Add export actions
+    $exportMenu = [];
+    foreach ($this->exporters as $action => $exporter) {
+      $exportMenu[] = new Action(
+        $action, $exporter['label'], $exporter['image'],
+        '0', 'export'
+      );
+    }
+    $this->registerAction(
+     new SubMenuAction(
+       'export', _('Export list'), 'geticon.php?context=actions&icon=document-export&size=16',
+       $exportMenu
+     )
+    );
+
+    $this->registerAction(
+     new Action(
+       'edit', _('Edit'), 'geticon.php?context=actions&icon=document-edit&size=16',
+       '+', 'editEntry'
+     )
+    );
+    $this->actions['edit']->setSeparator(TRUE);
+
+    if (!$this->skipCpHandler) {
+      $this->registerAction(
+        new Action(
+          'cut', _('Cut'), 'geticon.php?context=actions&icon=edit-cut&size=16',
+          '+', 'copyPasteHandler',
+          ['dr']
+        )
+      );
+      $this->registerAction(
+        new Action(
+          'copy', _('Copy'), 'geticon.php?context=actions&icon=edit-copy&size=16',
+          '+', 'copyPasteHandler',
+          ['r']
+        )
+      );
+      $this->registerAction(
+        new Action(
+          'paste', _('Paste'), 'geticon.php?context=actions&icon=edit-paste&size=16',
+          '0', 'copyPasteHandler',
+          ['w']
+        )
+      );
+      $this->actions['paste']->setEnableFunction([$this, 'enablePaste']);
+    }
+
+    $this->registerAction(
+     new Action(
+       'remove', _('Remove'), 'geticon.php?context=actions&icon=edit-delete&size=16',
+       '+', 'removeRequested',
+       ['d']
+     )
+    );
+
+    if (!static::$skipSnapshots && ($config->get_cfg_value('enableSnapshots') == 'TRUE')) {
+      $this->registerAction(
+        new Action(
+          'snapshot', _('Create snapshot'), 'geticon.php?context=actions&icon=snapshot&size=16',
+          '1', 'createSnapshotDialog',
+          ['/SnapshotHandler/c']
+        )
+      );
+      $this->registerAction(
+        new Action(
+          'restore', _('Restore snapshot'), 'geticon.php?context=actions&icon=document-restore&size=16',
+          '*', 'restoreSnapshotDialog',
+          ['w', '/SnapshotHandler/r']
+        )
+      );
+      $this->actions['snapshot']->setSeparator(TRUE);
+      $this->actions['restore']->setEnableFunction([$this, 'enableSnapshotRestore']);
+    }
+
+
+    /* Actions from footer are not in any menus and do not need a label */
+    $this->registerAction(new HiddenAction('apply',           'applyChanges'));
+    $this->registerAction(new HiddenAction('save',            'saveChanges'));
+    $this->registerAction(new HiddenAction('cancel',          'cancelEdit'));
+    $this->registerAction(new HiddenAction('cancelDelete',    'cancelEdit'));
+    $this->registerAction(new HiddenAction('removeConfirmed', 'removeConfirmed'));
+    if (!$this->skipConfiguration) {
+      $this->registerAction(new HiddenAction('configure', 'configureDialog'));
+    }
+  }
+
+
+}
diff --git a/plugins/addons/mailtemplate/class_mailTemplateUserRecovery.inc b/plugins/addons/mailtemplate/class_mailTemplateUserRecovery.inc
new file mode 100644
index 0000000000000000000000000000000000000000..efa76ec0f88ea23495bbdf15afb7c288da427c59
--- /dev/null
+++ b/plugins/addons/mailtemplate/class_mailTemplateUserRecovery.inc
@@ -0,0 +1,111 @@
+<?php
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org)
+
+  Copyright (C) 2018-2022 FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+class mailTemplateUserRecovery extends simplePlugin
+{
+  protected $displayHeader = TRUE;
+
+  static function plInfo (): array
+  {
+    return [
+      'plShortName'   => _('Mail Template User Recovery'),
+      'plDescription' => _('Mail Template User Recovery'),
+      'plIcon'        => 'geticon.php?context=applications&icon=supann&size=48',
+      'plSmallIcon'   => 'geticon.php?context=applications&icon=supann-status&size=16',
+      'plPriority'    => 31,
+      'plObjectClass' => ['fdMailTemplateUserRecovery'],
+      'plFilter'      => '(objectClass=fdMailTemplateUserRecovery)',
+      'plObjectType'  => ['mailTemplate'],
+      'plConflicts'   => ['mailTemplateUserReminder', 'mailTemplateInvitations'],
+      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
+    ];
+  }
+
+  static function getAttributesInfo (): array
+  {
+    return  [
+      'first_email' => [
+        'name' => _('First email'),
+        'attrs' => [
+          new StringAttribute(
+            _('Subject'),
+            _('Subject of the first email'),
+            'fdMTPasswordRecoveryMailSubject',
+            TRUE,
+            _("[FusionDirectory] Password recovery link")
+          ),
+          new TextAreaAttribute(
+            _('Body'),
+            _('Body of the first email, sent when the user ask for a new password. Use %login% for the login and %link% for the recovery link.'),
+            'fdMTPasswordRecoveryMailBody',
+            TRUE,
+            _("Hello,\n\nHere is your information: \n - Login : %login%\n - Link : %link%\n\nThis link is only valid for 10 minutes.")
+          )
+        ]
+      ],
+      'second_email' => [
+        'name' => _('Second email'),
+        'attrs' => [
+          new StringAttribute(
+            _('Subject'),
+            _('Subject of the second email'),
+            'fdMTPasswordRecoveryMail2Subject',
+            TRUE,
+            _("[FusionDirectory] Password recovery successful")
+          ),
+          new TextAreaAttribute(
+            _('Body'),
+            _('Body of the second email, sent to confirm the password has been changed. Use %login% for the user login.'),
+            'fdMTPasswordRecoveryMail2Body',
+            TRUE,
+           _("Hello,\n\nYour password has been changed.\nYour login is still %login%.")
+          )
+        ]
+      ]
+    ];
+  }
+
+  function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE)
+  {
+    global $config;
+    parent::__construct($dn, $object, $parent, $mainTab);
+  }
+
+  protected function shouldSave (): bool
+  {
+    global $config;
+
+    $ldap = $config->get_ldap_link();
+    $ldap->cd($config->current['BASE']);
+    $ldap->search('(&(objectClass=fdMailTemplateUserRecovery))', ['cn','fdMTPasswordRecoveryMailSubject']);
+    while ($attrs = $ldap->fetch()) {
+      if (isset($this->attrs['fdMTPasswordRecoveryMailSubject'])) {
+        $error = new FusionDirectoryError(htmlescape(sprintf(_('User Recovery Mail Template Is Already Existing!'))));
+        $error->display();
+
+        return FALSE;
+      }
+    }
+
+    return TRUE;
+  }
+
+}
diff --git a/plugins/addons/mailtemplate/class_mailTemplateUserReminder.inc b/plugins/addons/mailtemplate/class_mailTemplateUserReminder.inc
new file mode 100644
index 0000000000000000000000000000000000000000..455d9bc7bf3b6f77a5e475f1d2ae1aae05f31874
--- /dev/null
+++ b/plugins/addons/mailtemplate/class_mailTemplateUserReminder.inc
@@ -0,0 +1,173 @@
+<?php
+
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org)
+
+  Copyright (C) 2018-2022 FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+class mailTemplateUserReminder extends simplePlugin
+{
+  protected $displayHeader = TRUE;
+
+  static function plInfo (): array
+  {
+    return [
+      'plShortName'   => _('Mail Template User Reminder'),
+      'plDescription' => _('Mail Template User Reminder'),
+      'plIcon'        => 'geticon.php?context=applications&icon=supann&size=48',
+      'plSmallIcon'   => 'geticon.php?context=applications&icon=supann-status&size=16',
+      'plPriority'    => 32,
+      'plObjectClass' => ['fdMailTemplateUserReminder'],
+      'plFilter'      => '(objectClass=fdMailTemplateUserReminder)',
+      'plObjectType'  => ['mailTemplate'],
+      'plConflicts'   => ['mailTemplateUserRecovery', 'mailTemplateInvitations'],
+      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
+    ];
+  }
+
+  static function getAttributesInfo (): array
+  {
+    return [
+      'emailppolicy' => [
+        'name'  => _('Ppolicy email settings'),
+        'attrs' => [
+          new BooleanAttribute(
+            _('Forward alerts to the manager'), _('Forward ppolicy alerts to the manager'),
+            'fdMTUserReminderForwardPpolicyAlert', FALSE,
+            TRUE
+          ),
+          new StringAttribute(
+            _('Subject'), _('Subject of the ppolicy alert email'),
+            'fdMTUserReminderPpolicyAlertSubject', FALSE,
+            _('[FusionDirectory] Your password is about to expire')
+          ),
+          new TextAreaAttribute(
+            _('Body (%s are cn and login)'),
+            _('Body of the ppolicy alert email, sent when the user password is about to expire.'),
+            'fdMTUserReminderPpolicyAlertBody', FALSE,
+            _('Dear %sn%,'."\n".
+              'your password for account %login% is about to expire, please change your password: '."\n".
+              'https://'.$_SERVER['SERVER_NAME'].
+              (($_SERVER['SERVER_PORT'] != '80') ? ':'.$_SERVER['SERVER_PORT'] : '').
+              (empty($_SERVER['REQUEST_URI']) ? $_SERVER['PATH_INFO'] : $_SERVER['REQUEST_URI']).
+              "\n")
+          )
+        ]
+      ],
+      'alert_mail_reminder' => [
+        'name'  => _('Alert email settings'),
+        'attrs' => [
+          new BooleanAttribute(
+            _('Forward alerts to the manager'), _('Forward alerts to the manager'),
+            'fdMTUserReminderForwardAlert', TRUE,
+            TRUE
+          ),
+          new StringAttribute(
+            _('Subject'), _('Subject of the alert email'),
+            'fdMTUserReminderAlertSubject', FALSE,
+            _('[FusionDirectory] Your account is about to expire')
+          ),
+          new TextAreaAttribute(
+            _('Body'),
+            _('Body of the alert email, sent when the user is about to expire.'),
+            'fdMTUserReminderAlertBody', FALSE,
+            _('Dear %sn%,'."\n".
+              'your account %login% is about to expire, please use this link to avoid this: '."\n".
+              'https://'.$_SERVER['SERVER_NAME'].
+              (($_SERVER['SERVER_PORT'] != '80') ? ':'.$_SERVER['SERVER_PORT'] : '').
+              (empty($_SERVER['REQUEST_URI']) ? $_SERVER['PATH_INFO'] : $_SERVER['REQUEST_URI']).
+              '/expired_postpone.php?uid=%login%&token=%token%'."\n")
+          )
+        ]
+      ],
+      'alert_mail_confirmation' => [
+        'name'  => _('Confirmation email settings'),
+        'attrs' => [
+          new BooleanAttribute(
+            _('Forward confirmation to the manager'), _('Forward account extension confirmation to the manager'),
+            'fdMTUserReminderForwardConfirmation', TRUE,
+            TRUE
+          ),
+          new StringAttribute(
+            _('Subject'), _('Subject of the confirmation email'),
+            'fdMTUserReminderConfirmationSubject', FALSE,
+            _('[FusionDirectory] Your account expiration has been postponed')
+          ),
+          new TextAreaAttribute(
+            _('Body'),
+            _('Body of the confirmation email, sent when the user has postponed expiration.'),
+            'fdMTUserReminderConfirmationBody', FALSE,
+            _('Dear %sn%,'."\n".' your account %login% expiration has been successfully postponed.'."\n")
+          ),
+        ]
+      ],
+      'alert_mail_expiration' => [
+        'name'  => _('Expiration email settings'),
+        'attrs' => [
+          new BooleanAttribute(
+            _('Forward to the manager'), _('Forward account expiration to the manager'),
+            'fdMTUserReminderForwardExpiration', TRUE,
+            TRUE
+          ),
+          new StringAttribute(
+            _('Subject'), _('Subject of the expiration email'),
+            'fdMTUserReminderExpirationSubject', FALSE,
+            _('[FusionDirectory] Your account has expired')
+          ),
+          new TextAreaAttribute(
+            _('Body (%s are cn and login)'),
+            _('Body of the expiration email, sent when the user has expired.'),
+            'fdMTUserReminderExpirationBody', FALSE,
+            _('Dear %sn%,'."\n".' your account %login% has expired.'."\n")
+          ),
+        ]
+      ],
+    ];
+  }
+
+  function __construct (string $dn = NULL, $object = NULL, $parent = NULL, bool $mainTab = FALSE, array $attributesInfo = NULL)
+  {
+    parent::__construct($dn, $object, $parent, $mainTab, $attributesInfo);
+
+    if (!class_available('ppolicy')) {
+      $this->attributesAccess['fdMTUserReminderForwardPpolicyAlert']->setDisabled(TRUE);
+      $this->attributesAccess['fdMTUserReminderPpolicyAlertSubject']->setDisabled(TRUE);
+      $this->attributesAccess['fdMTUserReminderPpolicyAlertBody']->setDisabled(TRUE);
+    }
+  }
+
+  protected function shouldSave (): bool
+  {
+    global $config;
+
+    $ldap = $config->get_ldap_link();
+    $ldap->cd($config->current['BASE']);
+    $ldap->search('(&(objectClass=fdMailTemplateUserReminder))', ['cn','fdMTUserReminderAlertSubject']);
+    while ($attrs = $ldap->fetch()) {
+      if (isset($this->attrs['fdMTUserReminderAlertSubject'])) {
+        $error = new FusionDirectoryError(htmlescape(sprintf(_('User Reminder Mail Template Is Already Existing!'))));
+        $error->display();
+
+        return FALSE;
+      }
+    }
+
+    return TRUE;
+  }
+}
+
diff --git a/plugins/config/mailtemplate/class_mailTemplateConfig.inc b/plugins/config/mailtemplate/class_mailTemplateConfig.inc
new file mode 100644
index 0000000000000000000000000000000000000000..a1a2e8957ed6635ba889de9367e8a2fa09ef0f8f
--- /dev/null
+++ b/plugins/config/mailtemplate/class_mailTemplateConfig.inc
@@ -0,0 +1,52 @@
+<?php
+/*
+  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
+  Copyright (C) 2012-2022 FusionDirectory
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+class mailTemplateConfig extends multiPluginSection
+{
+  static function plInfo (): array
+  {
+    return [
+      'plShortName'     => _('mail template configuration'),
+      'plDescription'   => _('FusionDirectory mail template plugin configuration'),
+      'plObjectClass'   => ['fdMailTemplateConf'],
+      'plCategory'      => ['configuration'],
+      'plObjectType'    => ['smallConfig'],
+
+      'plProvidedAcls'  => parent::generatePlProvidedAcls(static::getAttributesInfo())
+    ];
+  }
+
+  static function getAttributesInfo (): array
+  {
+    return [
+      'mailTemplateConf' => [
+        'name'  => _('Mail Template'),
+        'attrs' => [
+          new StringAttribute(
+            _('Mail Template RDN'), _('Branch in which Directory Base, mails templates will be stored'),
+            'fdMailTemplateRDN', TRUE,
+            'ou=mailTemplate'
+          ),
+        ]
+      ],
+    ];
+  }
+}
+