1 (edited by igortru 2013-11-08 08:14:59)

Topic: glpi lost mail from users

Hi.

Sorry for my english )
I have problem, glpi lost some mail from users, no ticket create.
i switch on debug mode and view errors on sql-errors.log

2013-11-08 11:13
*** MySQL query error :
***
SQL: SELECT `users_id` as id
                FROM `glpi_useremails`
                LEFT JOIN `glpi_users` ON (`glpi_users`.`id` = `glpi_useremails`.`users_id`)
                WHERE `glpi_useremails`.`email` = \'\'helpdesk@domain.ru\'\'
                ORDER BY `glpi_users`.`is_active`  DESC
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
 near 'helpdesk@domain.ru''
                ORDER BY `glpi_users`.`is_active`  DESC' at line 4
Backtrace :
/usr/share/glpi/inc/user.class.php :2786           DBmysql->query()
/usr/share/glpi/inc/mailcollector.class.php :607           User::getOrImportByEmail()
/usr/share/glpi/inc/mailcollector.class.php :417           MailCollector->buildTicket()
/usr/share/glpi/front/mailcollector.form.php :72           MailCollector->collect()
/usr/share/glpi/front/mailcollector.form.php

i find code in user.class.php and insert debug code

   static function getOrImportByEmail($email='') {
      global $DB, $CFG_GLPI;

      $query = "SELECT `users_id` as id
                FROM `glpi_useremails`
                LEFT JOIN `glpi_users` ON (`glpi_users`.`id` = `glpi_useremails`.`users_id`)
                WHERE `glpi_useremails`.`email` = '$email'
                ORDER BY `glpi_users`.`is_active`  DESC";
[b]    $new_file=fopen("/var/log/glpi/test.log","a+"); 
    fwrite($new_file, "\n".$email."\n");
    fwrite($new_file, $query);
    fclose($new_file);
[/b]      $result = $DB->query($query);

in test.log i see normaly user e-mail  (not helpdesk@domain.ru)

SELECT `users_id` as id
                FROM `glpi_useremails`
                LEFT JOIN `glpi_users` ON (`glpi_users`.`id` = `glpi_useremails`.`users_id`)
                WHERE `glpi_useremails`.`email` = 'user@domain.ru'
                ORDER BY `glpi_users`.`is_active`  DESC

I don't know as to solve a problem....
glpi sync ldap, glpi get e-mail in pop3 account.
thx
Igor, Russia

2

Re: glpi lost mail from users

What is the From in the header of the mail ?
Version of GLPI used ?

Prod : RHEL 4.6/5.4 - php 5.1.6/5.2.13 + APC + memcached - MySQL 5.0.45 - OCS 1.01 - GLPI 0.83.8 svn  (>130 000 PMF - 334 entités)
Dev : Fedora 14 - PHP 5.4.12 - .GLPI 0.84 SVN - GLPI 0.85 SVN
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

3

Re: glpi lost mail from users

yllen wrote:

What is the From in the header of the mail ?
Version of GLPI used ?

thx for reply,
I had a few times for a solution,  i find problem - some mail client not insert Message-ID in message header.
glpi drop this mail.
how solve this problem?

4

Re: glpi lost mail from users

i solve problem, but unknown correct is

in mailcollector.class.php
in line 933

        // secu on subject setting
         if (!isset($mail_header->subject)) {
            $mail_header->subject = '';
         }

add

         if (!isset($mail_header->message_id)) {
            $mail_header->message_id = '';
         }