You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-06-13 09:34:39

Thibaultp
Member
Registered: 2023-06-13
Posts: 2

Mail sending problems php error

Hello,
I have a problem sending mail on glpi. In the php-errors.log of glpi the problem comes from the NotificationEventMailing.php file. Here are the logs in detail :

[2023-06-13 09:02:27] glpiphplog.WARNING:   *** PHP Warning (2): Undefined array key "filepath" in /var/www/html/glpi/src/NotificationEventMailing.php at line 295
  Backtrace :
  src/QueuedNotification.php:602                     NotificationEventMailing::send()
  src/CronTask.php:1018                              QueuedNotification::cronQueuedNotification()
  front/crontask.form.php:52                         CronTask::launch()

[2023-06-13 09:02:27] glpiphplog.WARNING:   *** PHP Warning (2): Trying to access array offset on value of type bool in /var/www/html/glpi/src/NotificationEventMailing.php at line 296
  Backtrace :
  src/QueuedNotification.php:602                     NotificationEventMailing::send()
  src/CronTask.php:1018                              QueuedNotification::cronQueuedNotification()
  front/crontask.form.php:52                         CronTask::launch()

[2023-06-13 09:02:27] glpiphplog.WARNING:   *** PHP Warning (2): Trying to access array offset on value of type bool in /var/www/html/glpi/src/NotificationEventMailing.php at line 297
  Backtrace :
  src/QueuedNotification.php:602                     NotificationEventMailing::send()
  src/CronTask.php:1018                              QueuedNotification::cronQueuedNotification()
  front/crontask.form.php:52                         CronTask::launch()

[2023-06-13 09:02:27] glpiphplog.CRITICAL:   *** Uncaught Exception DivisionByZeroError: Division by zero in /var/www/html/glpi/src/NotificationEventMailing.php at line 301
  Backtrace :
  src/QueuedNotification.php:602                     NotificationEventMailing::send()
  src/CronTask.php:1018                              QueuedNotification::cronQueuedNotification()
  front/crontask.form.php:52                         CronTask::launch()

[2023-06-13 09:02:27] glpiphplog.WARNING:   *** PHP Warning (2): error_log(/var/www/html/glpi/files/_log/cron.log): Failed to open stream: Permission denied in /var/www/html/glpi/src/Toolbox.php at line 598
  Backtrace :
  src/Toolbox.php:598                                error_log()
  src/CronTask.php:1030                              Toolbox::logInFile()
  front/crontask.form.php:52                         CronTask::launch()

Thank you in advance for your feedback.

Offline

#2 2023-06-13 11:47:12

Thibaultp
Member
Registered: 2023-06-13
Posts: 2

Re: Mail sending problems php error

I have new information about glpi problems

PHP Warning:  Module "intl" is already loaded in Unknown on line 0
PHP Warning:  Undefined array key "filepath" in /var/www/html/glpi/src/NotificationEventMailing.php on line 290
PHP Warning:  Undefined array key "filepath" in /var/www/html/glpi/src/NotificationEventMailing.php on line 295
PHP Notice:  getimagesize(): Read of 8192 bytes failed with errno=21 Is a directory in /var/www/html/glpi/src/NotificationEventMailing.php on line 295
PHP Notice:  getimagesize(): Error reading from /var/www/html/glpi/files/! in /var/www/html/glpi/src/NotificationEventMailing.php on line 295
PHP Warning:  Trying to access array offset on value of type bool in /var/www/html/glpi/src/NotificationEventMailing.php on line 296
PHP Warning:  Trying to access array offset on value of type bool in /var/www/html/glpi/src/NotificationEventMailing.php on line 297
Uncaught Exception DivisionByZeroError: Division by zero in /var/www/html/glpi/src/NotificationEventMailing.php at line 301

Offline

#3 2023-12-11 11:26:53

Chouille75
Member
Registered: 2008-05-30
Posts: 32

Re: Mail sending problems php error

Hello.
Got same error and consequently, have an issue to send notifications (Maybe due to a picture in sign when ticket was created from mailgate).

As a workaround, i update src/NotificationEventMailing.php by surronding the ratio image size by a condition on $initial_width and $initial_height that have not to be null or equal to 0 :


if($initial_width !== null && $initial_width !== 0 && $initial_height !== null && $initial_height !== 0){
   
                                        if ($custom_width !== null && $custom_height === null) {
                                            //compute height if needed
                                               $custom_height = $initial_height * $custom_width / $initial_width;
                                            } elseif ($custom_height !== null && $custom_width === null) {
                                                //compute width if needed
                                                $custom_width = $initial_width * $custom_height / $initial_height;
                                            } elseif ($custom_height === null && $custom_width === null) {
                                                //if both are null keep initial size
                                                $custom_width = $initial_width;
                                                $custom_height = $initial_height;
                                            }

                                        $image_path = Document::getImage(
                                               GLPI_DOC_DIR . "/" . $doc->fields['filepath'],
                                            'mail',
                                            $custom_width,
                                            $custom_height
                                        );
                                        if (
                                            $mmail->AddEmbeddedImage(
                                                $image_path,
                                                $doc->fields['tag'],
                                                $doc->fields['filename'],
                                                'base64',
                                                $doc->fields['mime']
                                            )
                                        ) {
                                            $inline_docs[$docID] = $doc->fields['tag'];
                                        }
}

Offline

Board footer

Powered by FluxBB