{% extends request.ajax ? 'layout_blank.html.twig' : 'layout_default.html.twig' %} {% block meta_title %}{{ 'Mail Gateway Settings'|trans }}{% endblock %} {% set active_menu = 'system' %} {% set result = admin.mailgateway_settings_get({}) %} {% set params = result.settings %} {% block content %} {% if result.notifications is defined %}
{% if result.notifications.ready %} {{ 'Ticket acknowledgement and enabled staff notification subjects are configured for email replies.'|trans }} {% else %}

{{ 'Ticket notifications need configuration. Enabling mailbox importing will configure them automatically, or use Advanced below.'|trans }}

{% endif %}
{% endif %} {% if result.dependencies is defined and not result.dependencies.installed %}
{% if result.dependencies.available %}

{{ 'Install the required mail library before testing connections or enabling imports.'|trans }}

{% else %}

{{ 'Automatic installation is unavailable on this server. Run composer install from the Mailgateway directory using SSH.'|trans }}

{% endif %}
{% endif %} {% set mailboxes = result.mailboxes is defined ? result.mailboxes : {'default': result.settings} %} {% set newMailbox = result.settings|merge({'password_configured': false, 'enabled': false, 'mailbox': '', 'username': '', 'test_passed': false, 'test_result': null}) %} {% for mailboxId, params in mailboxes|merge({'new': newMailbox}) %} {% set canEnable = result.dependencies.installed|default(false) and params.test_passed|default(false) %} {% set disabledReason = not result.dependencies.installed|default(false) ? 'Install dependencies before enabling mailbox importing.'|trans : 'Save this mailbox, then run Test Connection and Create Folders successfully before enabling importing. Connection, password, or folder changes require another test.'|trans %}

{{ mailboxId == 'new' ? 'New mailbox'|trans : params.mailbox }}

{{ 'Each enabled mailbox routes new tickets to its selected helpdesk. The existing FOSSBilling cron polls mailboxes at the interval defined in the module configuration file.'|trans }}

{% if not canEnable %}{{ disabledReason }}{% endif %}
{{ 'TLS certificate validation is always enabled.'|trans }}
{% if params.password_configured %}{{ 'A password is saved. Leave blank to keep it.'|trans }}{% else %}{{ 'No password is saved.'|trans }}{% endif %}
{% for field, label in {'inbox_folder': 'Inbox folder', 'processed_folder': 'Processed folder', 'ignored_folder': 'Ignored folder', 'failed_folder': 'Failed folder'} %}
{% endfor %}

{{ 'Only the configured inbox is imported. Keep spam in a separate folder. Enabled mailboxes are imported automatically by FOSSBilling cron.'|trans }}

{% if mailboxId != 'new' %} {% endif %}
{% endfor %}
{{ 'Advanced'|trans }}

{{ 'Maintenance actions preserve saved mailbox settings and existing ticket data.'|trans }}

{% if result.notifications is defined %}

{{ 'Ticket notifications'|trans }}

{% if result.notifications.ready %}

{{ 'Ticket acknowledgement and enabled staff notification subjects are configured for email replies.'|trans }}

{% else %}
    {% for error in result.notifications.errors %}
  • {{ error }}
  • {% endfor %}
{% endif %}

{{ 'Setup enables the ticket acknowledgement and adds ticket numbers to its subject and enabled staff notification subjects. Existing wording is kept.'|trans }}

{% endif %}

{{ 'Composer dependencies'|trans }}

{% if result.dependencies.installed|default(false) %}

{{ 'Mail Gateway dependencies are installed.'|trans }}

{% else %}

{{ 'Mail Gateway dependencies are not installed.'|trans }}

{% endif %}

{{ 'Run composer install again using the module lock file, even when dependencies are already installed.'|trans }}

{% if result.dependencies is defined and result.dependencies.available %}
{% else %}

{{ 'Web installation is unavailable. Run composer install from the Mailgateway directory using SSH.'|trans }}

{% endif %}

{{ 'Module table setup'|trans }}

{{ 'Runs the same setup as php tools/setup.php. Creates missing module tables and adds the default mismatch email template if absent. Existing records and templates are kept. Composer runs separately.'|trans }}

{% endblock %}