CoreBOSBB

Full Version: [ solved ] issue for mail converter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
one mailbox scanner shows me the error

[INFO]: MailScanner - cron task had timedout as it is not completed last time it run- restarting Scanning imap.umbler.com in progress Sorry! Attempt to access restricted file.
We are looking for this file path: modules//.php
We are looking here:
Real file path:
Root dir path: /usr/share/corebos/corebos-master/

how I can solved that?
that error message is usually caused by an SQL error, activate the debug log and see if you can see it. Share that, see if we can understand what is happening
I found that message

2020-05-04T09:15:19-03:00 INFO DB DB >ADODB error Query Failed:insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,modifiedby,createdtime,modifiedtime,cbuuid) values(?,?,?,?,?,?,?,?,?)::->[1366]Incorrect string value: '\xE9rica,...' for column `NossoCRM`.`vtiger_crmentity`.`description` at row 1
from this discussion https://stackoverflow.com/questions/2108824/mysql-incorrect-string-value-error-when-save-unicode-string-in-django
I understand that the problem is with the database.
Is your database and specifically your vtiger_crmentity.description using UTF-8?
yes, DB and table set UTF-8

there another Error in log

2020-05-04T15:35:23-03:00 DEBUG index > pquery insert into vtiger_troubletickets(ticketid,ticket_no,parent_id,priority,severity,status,category,update_log,hours,days,from_portal,title,solution,from_mailscanner,commentadded) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
2020-05-04T15:35:23-03:00 DEBUG index > pquery parameters [149339,TT84855,0,,,Open,,,0,0,0,[Fail2Ban] SSH-issabel: banned 188.87.199.55 from localhost,,1,0]
2020-05-04T15:35:23-03:00 INFO DB DB >ADODB error Query Failed:insert into vtiger_troubletickets(ticketid,ticket_no,parent_id,priority,severity,status,category,update_log,hours,days,from_portal,title,solution,from_mailscanner,commentadded) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)::->[1452]Cannot add or update a child row: a foreign key constraint fails (`NossoCRM`.`vtiger_troubletickets`, CONSTRAINT `fk_1_vtiger_troubletickets` FOREIGN KEY (`ticketid`) REFERENCES `vtiger_crmentity` (`crmid`) ON DELETE CASCADE)
2020-05-04T15:35:23-03:00 DEBUG index > insertIntoEntityTable HelpDesk vtiger_ticketcf
2020-05-04T15:35:23-03:00 DEBUG index > getTabid HelpDesk
2020-05-04T15:35:23-03:00 DEBUG index < getTabid

020-05-04T15:35:23-03:00 DEBUG index > pquery insert into vtiger_ticketcf(ticketid,cf_748,cf_752,cf_785,cf_787,cf_788,cf_1075) values(?,?,?,?,?,?,?)
2020-05-04T15:35:23-03:00 DEBUG index > pquery parameters [149339,0,,0,,,0]
2020-05-04T15:35:23-03:00 INFO DB DB >ADODB error Query Failed:insert into vtiger_ticketcf(ticketid,cf_748,cf_752,cf_785,cf_787,cf_788,cf_1075) values(?,?,?,?,?,?,?)::->[1452]Cannot add or update a child row: a foreign key constraint fails (`NossoCRM`.`vtiger_ticketcf`, CONSTRAINT `fk_1_vtiger_ticketcf` FOREIGN KEY (`ticketid`) REFERENCES `vtiger_troubletickets` (`ticketid`) ON DELETE CASCADE)
2020-05-04T15:35:23-03:00 DEBUG index > insertIntoTicketCommentTable
2020-05-04T15:35:23-03:00 DEBUG index < insertIntoTicketCommentTable
2020-05-04T15:35:23-03:00 INFO DB DB >TRANS Rolled Back
2020-05-04T15:35:23-03:00 INFO DB DB >TRANS Completed
Apply this change and let me know if it makes a difference

Code:
diff --git a/modules/Settings/MailScanner/core/MailScannerAction.php b/modules/Settings/MailScanner/core/MailScannerAction.php
index 10ce017d9..969e39fd7 100644
--- a/modules/Settings/MailScanner/core/MailScannerAction.php
+++ b/modules/Settings/MailScanner/core/MailScannerAction.php
@@ -67,6 +67,10 @@ class Vtiger_MailScannerAction {
               }
       }

+       public function cleanUTF8($value) {
+               return function_exists('iconv') ? @iconv('UTF-8', 'UTF-8//IGNORE', $value) : $value;
+       }
+
       /**
        * Create/Update the information of Action into database.
        */
@@ -238,8 +242,8 @@ class Vtiger_MailScannerAction {
       public function __CreateTicket($mailscanner, $mailrecord) {
               global $adb;
               // Prepare data to create trouble ticket
-               $usetitle = $mailrecord->_subject;
-               $description = $mailrecord->getBodyText();
+               $usetitle = $this->cleanUTF8($mailrecord->_subject);
+               $description = $this->cleanUTF8($mailrecord->getBodyText());

               // There will be only on FROM address to email, so pick the first one
               $fromemail = $mailrecord->_from[0];
@@ -338,9 +342,9 @@ class Vtiger_MailScannerAction {
               $focus->column_fields['parent_type'] = $module;
               $focus->column_fields['activitytype'] = 'Emails';
               $focus->column_fields['parent_id'] = "$linkfocus->id@$relid|";
-               $focus->column_fields['subject'] = $mailrecord->_subject;
+               $focus->column_fields['subject'] = $this->cleanUTF8($mailrecord->_subject);

-               $focus->column_fields['description'] = $mailrecord->getBodyHTML();
+               $focus->column_fields['description'] = $this->cleanUTF8($mailrecord->getBodyHTML());
               $focus->column_fields['assigned_user_id'] = $linkfocus->column_fields['assigned_user_id'];
               $focus->column_fields['date_start'] = date('Y-m-d', $mailrecord->_date);
               $focus->column_fields['email_flag'] = 'MAILSCANNER';
It's is very strange situation

e-mails originally sent to a mailbox in gMail and mail converter read and created ticket, without a problem
When I change destination to another mail server ( umbler ) and changed mail scanner rules, problem occurs

I try include this path, and not solved
I completed removed mailbox, scanner rules, and recreated them

Until now, scanner woks