{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2024 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # 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 3 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, see . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% if (config('notifications_mailing') == 1) %} {% set rand = random() %} {% set field_options = { 'field_class': 'col-12 col-xxl-6 col-sm-6', 'rand': rand, } %}
{{ fields.emailField( 'admin_email', config('admin_email'), __('Administrator email address'), field_options ) }} {{ fields.textField( 'admin_email_name', config('admin_email_name'), __('Administrator name'), field_options ) }} {{ fields.emailField( 'from_email', config('from_email'), __('Email sender address'), field_options|merge({ 'helper': __('Address to use in from for sent emails.') ~ '\n' ~ __('If not set, main or entity administrator email address will be used.') }) ) }} {{ fields.textField( 'from_email_name', config('from_email_name'), __('Email sender name'), field_options|merge({ 'helper': __('Name to use in from for sent emails.') ~ '\n' ~ __('If not set, main or entity administrator email name will be used.') }) ) }} {{ fields.emailField( 'replyto_email', config('replyto_email'), __('Reply-To address'), field_options|merge({ 'helper': __('Optionnal reply to address.') ~ '\n' ~ __('If not set, main or entity administrator email address will be used.') }) ) }} {{ fields.textField( 'replyto_email_name', config('replyto_email_name'), __('Reply-To name'), field_options|merge({ 'helper': __('Optionnal reply to name.') ~ '\n' ~ __('If not set, main or entity administrator name will be used.') }) ) }} {{ fields.emailField( 'noreply_email', config('noreply_email'), __('No-Reply address'), field_options|merge({ 'helper': __('Optionnal No-Reply address.') ~ '\n' ~ __('If set, it will be used for notifications that doesnʼt expect a reply.') }) ) }} {{ fields.textField( 'noreply_email_name', config('noreply_email_name'), __('No-Reply name'), field_options|merge({ 'helper': __('Optionnal No-Reply name.') ~ '\n' ~ __('If not set, main or entity administrator name will be used.') }) ) }} {{ fields.dropdownArrayField( "attach_ticket_documents_to_mail", config('attach_ticket_documents_to_mail'), attach_documents_values, __('Add documents into ticket notifications'), field_options ) }} {{ fields.nullField() }} {{ fields.textareaField( 'mailing_signature', config('mailing_signature'), __('Email signature'), field_options ) }} {{ fields.nullField() }} {% set extra_options = {} %} {% if not is_mail_function_available %} {% set extra_options = { 'helper': __('The PHP mail function is unknown or is not activated on your system.') ~ '\n' ~ __('The use of a SMTP is needed.') } %} {% endif %} {{ fields.dropdownArrayField( "smtp_mode", config('smtp_mode'), mail_methods, __('Way of sending emails'), field_options|merge(extra_options) ) }} {{ fields.nullField() }} {{ fields.numberField( 'smtp_max_retries', config('smtp_max_retries'), __('Max. delivery retries'), field_options ) }} {{ fields.numberField( 'smtp_retry_time', config('smtp_retry_time'), __('Try to deliver again in (minutes)'), field_options|merge({ 'min': 0, 'max': 60, 'step': 1, }) ) }}
{{ 'AuthMail'|itemtype_name }}
{{ __('Once the form has been validated, you will be redirected to your supplierʼs authentication page if necessary.') }}
{{ fields.dropdownArrayField( 'smtp_oauth_provider', config('smtp_oauth_provider'), providers_values, __('Oauth provider'), field_options|merge({'display_emptychoice': true}) ) }} {{ fields.textField( '_smtp_oauth_callback_url', config('url_base') ~ '/front/smtp_oauth2_callback.php', _x('oauth', 'Callback URL'), field_options|merge({ 'helper': _x('oauth', 'This is the callback URL that you will have to declare in your provider application.'), 'is_copyable': true, 'readonly': true, }) ) }} {{ fields.textField( 'smtp_oauth_client_id', config('smtp_oauth_client_id'), _x('oauth', 'Client ID'), field_options, ) }} {{ fields.passwordField( 'smtp_oauth_client_secret', '', _x('oauth', 'Client secret'), field_options|merge({ 'clearable': false, 'additional_attributes': { 'autocomplete': 'new-password', } }), ) }} {% for provider_class in supported_providers %} {% for param_specs in call(provider_class ~ '::getAdditionalParameters') %} {% set extra_options = { 'additional_attributes': { 'data-oauth_additional_parameter': 'true', 'data-oauth_provider': provider_class, }, } %} {% if param_specs.helper is defined %} {% set extra_options = extra_options|merge({ 'helper': param_specs['helper'], }) %} {% endif %} {{ fields.textField( 'smtp_oauth_options[' ~ param_specs['key'] ~ ']', config('smtp_oauth_provider') == provider_class ? (provider_options[param_specs['key']] ?? param_specs['default'] ?? '') : '', param_specs['label'], field_options|merge(extra_options), ) }} {# force new line #}
{% endfor %} {% endfor %} {% if config('smtp_oauth_refresh_token') != '' %} {{ fields.checkboxField( '_force_redirect_to_smtp_oauth', '', _x('oauth', 'Force OAuth authentication refresh'), field_options|merge({ 'helper': _x('oauth', 'You can use this option to force redirection to the OAuth authentication process. This will trigger generation of a new OAuth token.') }) ) }} {# force new line #}
{% endif %} {{ fields.dropdownYesNo( 'smtp_check_certificate', config('smtp_check_certificate'), __('Check certificate'), field_options, ) }} {# force new line #}
{{ fields.textField( 'smtp_host', config('smtp_host'), __('SMTP host'), field_options, ) }} {{ fields.numberField( 'smtp_port', config('smtp_port'), _n('Port', 'Ports', 1), field_options, ) }} {{ fields.textField( 'smtp_username', config('smtp_username'), __('SMTP login (optional)'), field_options, ) }} {{ fields.passwordField( 'smtp_passwd', '', __('SMTP password (optional)'), field_options|merge({ 'additional_attributes': { 'autocomplete': 'new-password', } }), ) }} {{ fields.emailField( 'smtp_sender', config('smtp_sender'), __('Email sender'), field_options|merge({ 'helper': __('May be required for some mails providers.') ~ '\n' ~ __('If not set, main administrator email will be used.') }) ) }}
{% else %}
{{ __('Notifications are disabled.') }} {{ __('See configuration') }}
{% endif %}