EmailReporting in container not working

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Developer, Contributor

Post Reply
Banzai
Posts: 2
Joined: 11 Sep 2024, 10:24

EmailReporting in container not working

Post by Banzai »

Hello there,

I have tried many things to get the EmailReporting to work, without success.
On a pure installation with Mantis 2.24.x under Ubuntu 22.04 everything worked without problems.
Now I am using Mantis 2.26.3 in a Docker container.
After importing the database, all tickets, users and settings (including plugins) were also there and I copied EmailReporting-0.11.0-DEV directly from the old installation.

Every “test” or “complete test” only returns a blank white page.
Emails are no longer retrieved!

Also the manual call of “plugins/EmailReporting/scripts/bug_report_mail.php” brings only a few SQL statements:

Code: Select all

sudo /usr/bin/docker exec -it mantis_mantisbt_1 /usr/local/bin/php plugins/EmailReporting/scripts/bug_report_mail.php
2024-09-11 13:06 CEST DB database_api.php:166 db_connect() array (  0 => 'SET NAMES UTF8',  1 => '0.0002',)
2024-09-11 13:06 CEST DB plugin_api.php:1005 plugin_register_installed() array (....)
:
Sending emails for users are working with the same settings!
I have tried all possible settings for logging and debugging, but without any significant findings.

The following settings are in docker-compose:

Code: Select all

version: "3.8"

services:
  mantisbt:
    image: xlrl/mantisbt
    environment:
      MANTIS_TIMEZONE: Europe/Berlin
      MANTIS_ENABLE_ADMIN: 1
      PHP_DISPLAY_ERRORS: 1  # Fehler auf der Seite anzeigen
      PHP_DISPLAY_STARTUP_ERRORS: 1
      PHP_ERROR_REPORTING: 'E_ALL'  # Alle PHP-Fehler anzeigen
      PHP_LOG_ERRORS: 1  # Fehler in das Log schreiben
      PHP_ERROR_LOG: /var/www/html/config/php_errors.log
    ports:
      - "8989:80"
    links:
      - mysql
    depends_on:
      - mysql
    networks:
      - mantis_net
    volumes:
      - ./config:/var/www/html/config
      - ./custom:/var/www/html/custom
      - ./plugins:/var/www/html/plugins
      - ./log:/var/log/mantis
      - /tmp/mantis:/tmp/mantis
    restart: always

  mysql:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=mysecretpasswd2
      - MYSQL_DATABASE=bugtracker
      - MYSQL_USER=amantisuser
      - MYSQL_PASSWORD=mysecretpasswd
    volumes:
      - ./mysql:/var/lib/mysql
    networks:
      - mantis_net
    restart: always

networks:
  mantis_net:
    driver: bridge
/var/www/html/config/php_errors.log (or local directory as volume) are not written.

Code: Select all

ll config/
total 20
drwxrwxr-x 2 www-data www-data 4096 Sep 11 10:53 ./
drwxrwxr-x 8 mdtadmin mdtadmin 4096 Sep 11 09:52 ../
-rw-r--r-- 1 www-data www-data 2151 Sep 11 10:53 config_inc.php
-rw-r--r-- 1 www-data www-data  217 Sep 11 06:34 custom_constants_inc.php
-rw-r--r-- 1 www-data www-data 2071 Sep 11 05:39 custom_strings_inc.php
In the config.inc.php is this:

Code: Select all

<?php
$g_hostname               = 'mantis_mysql_1';
$g_db_type                = 'mysqli';
$g_database_name          = 'bugtracker';
$g_db_username            = 'mantisbtdb';
$g_db_password            = 'databasepwd';

$g_default_timezone       = 'Europe/Berlin';

$g_crypto_master_salt     = 'saltsaltsaltsalt';

$g_path                   = "https://manti.example.com:8765/"; // The port is configured and OK, using nginx as reverse proxy

/*
 ' login
*/
$g_allow_signup = OFF;

/*
 * mail
*/
$g_enable_email_notification = ON;
$g_administrator_email = 'admin@example.com';
$g_webmaster_email = 'admin@example.com'';
$g_from_email = 'manti@example.com';
$g_from_name = 'manti(at)example.com';
$g_return_path_email = 'manti@example.com';

$g_email_send_using_cronjob = OFF;
$g_phpMailer_method   = PHPMAILER_METHOD_SMTP; // SENDMAIL;

$g_smtp_host = 'my.mailhost.de';
$g_smtp_connection_mode = 'ssl';
$g_smtp_port = 465;
$g_smtp_username = 'manti@example.com';
$g_smtp_password = 'webaccountpasswd;

/*
 * configure states
*/
$g_status_colors['analysing'] = '#FFCC99';
$g_status_colors['analysed'] = '#FF9933';
$g_status_colors['resolving'] = '#99FF33';
$g_status_colors['resolved'] = '#66CC00';
$g_status_colors['verifying'] = '#3399FF';

$g_status_enum_string = '10:new,21:analysing,31:analysed,41:resolving,51:resolved,61:verifying,90:closed';
$g_status_enum_workflow[NEW_]        = '21:analysing';
$g_status_enum_workflow[ANALYSING]   = '31:analysed';
$g_status_enum_workflow[ANALYSED]    = '41:resolving,90:closed';
$g_status_enum_workflow[RESOLVING]   = '51:resolved,90:closed';
$g_status_enum_workflow[51]    = '61:verifying,90:closed';
$g_status_enum_workflow[VERIFYING]   = '90:closed';
$g_status_enum_workflow[CLOSED]      = '21:analysing';

$g_relationship_graph_enable = ON;

/*
 * logging
*/
$g_log_level = LOG_ALL; //LOG_MAIL | LOG_EMAIL_RECIPIENT;
$g_log_destination = 'file:/var/log/mantis/mantisbt.log';

$g_show_detailed_errors = ON;
$g_display_errors = array(
    E_WARNING => 'halt',
    E_NOTICE => 'halt',
    E_USER_ERROR => 'halt',
    E_USER_WARNING => 'halt',
    E_USER_NOTICE => 'halt'
);
The nginx config (reverse proxy) looks like:

Code: Select all

cat /etc/nginx/sites-available/mantis.moderndrive.com
server {
    listen 8765 ssl;
    listen [::]:8765 ssl;

    include snippets/my.com.conf;

    server_name manti.example.com;
    root   /var/www/mantis;
    index  index.php;

    access_log /var/log/nginx/mantis.access.log;
    error_log /var/log/nginx/mantis.error.log;

    client_max_body_size 100M;

    autoindex off;

    location / {
      proxy_pass http://[i]localhost_ip[/i]:8989;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
    }
}
In the meantime, I don't know which obstacle within the container is affecting the function of the plug-in.

Perhaps someone has experience with this? Any help would be welcome!
Thanks in advance!
SL-Gundam
Posts: 730
Joined: 06 Jul 2011, 14:17

Re: EmailReporting in container not working

Post by SL-Gundam »

I've never tried running MantisBT or EmailReporting in a docker container.

EmailReporting has two variables which i would like you to check. Please check the /adm_config_report.php page
- plugin_EmailReporting_mail_debug_directory
- plugin_EmailReporting_mail_mantisbt_url_fix

Concerning $g_path. EmailReporting uses that to cache the current hostname for later usage when sending emails.

Did you check the mantis.error.log?
Banzai
Posts: 2
Joined: 11 Sep 2024, 10:24

Re: EmailReporting in container not working

Post by Banzai »

Thanks for the quick reply!

I checked the information once and got the following result:

In the adm_config_report.php file, which I can only find once, there is no information about the two variables! However, I cannot find these variables in this file in the old installation either.

Code: Select all

root@6ca69ec8149a:/var/www/html# grep -R "plugin_EmailReporting_mail_mantisbt_url_fix" .
root@6ca69ec8149a:/var/www/html# grep -R "plugin_EmailReporting_mail_debug_directory" .
./plugins/EmailReporting/lang/strings_spanish.txt:$s_plugin_EmailReporting_mail_debug_directory = 'Guardar el contenido del email en este directorio si el modo depuración esta activo';
./plugins/EmailReporting/lang/strings_english.txt:$s_plugin_EmailReporting_mail_debug_directory = 'Save email contents to this directory if debug mode is activated';
./plugins/EmailReporting/lang/strings_german.txt:$s_plugin_EmailReporting_mail_debug_directory = 'Mailinhalte in diesen Ordner sichern, wenn der Debug Modus aktiv ist';
These are the only occurence of this variable.

The file mantis.error.log is empty; mantis.access.log is written.

If $g_path is missing, then Mantis also does not find some files (CSS etc.) and the output is not formatted.

I think I will install Mantis directly again and not run it in a container.

Thanks
Post Reply