tomolimo / mailanalyzer

Mail Analyzer GLPI Plugin may be used to combine CC mails into one Ticket
25 stars 10 forks source link

GLPI 9.5.3 e-mails being refused #51

Closed phamorais closed 3 years ago

phamorais commented 3 years ago

Hello!

I am using version 9.5.3 and I have a strange behavior when I have the MailAnalyzer plugin enabled, Emails are declined.

image

erro_mail

No error is being displayed in "php-errors.log"

But in the apache log I get this

image

If I disable the plugin the email is imported correctly

mail_correct

Can u Help @tomolimo ?

tomolimo commented 3 years ago

Hello @phamorais Did you look into the Apache logs when you have succeeded to import the email? I don't think that the errors shown in Apache logs are related to mailanalyzer plugin. Regarding the email not imported into GLPI, several questions:

  1. What is the profile of the email sender in GLPI?
  2. It seems to me that it is an answer to another email? If so could you explain the email flow (initial sender, CC, BCC, ...)?

Thank you Regards, Tomolimo

phamorais commented 3 years ago

@tomolimo Hi!

1 - The error occurs when opening tickets anonymously

2 - Really the example email is the response from the first email

The flow looks like this:

1 - Customer sends email to the account XTPO@outlook.com;

2 - The attendant inserts the followup in the GLPI; 3 - The Client receives the email; 4 - The Customer responds to the email by inserting more people in the "C / C" field;

This is still a test, we have not yet started production. Your placement was important, because in the test the email that is being sent for the collection of the GLPI is the Answer and not the original email.

I will test the flow again and give you feedback

phamorais commented 3 years ago

@tomolimo One Question If the first email I am importing into GLPI is a "Email response", and if the first email does not exist in GLPI, it should open a new ticket ... correct?

phamorais commented 3 years ago

@tomolimo

I tested it with a new email, with mail Analyzer enable

image

When trying to import the email through GLPI I get the error message

image

image

Error in php-erros

image

tomolimo commented 3 years ago

Hello @phamorais As you can see by yourself, in the error log, there is nowhere mention of mailanalyzer plugin... Usually this means that the plugin has nothing to do with the error. More than that, the error is a connection error. The mailanalyzer plugin itself doesn't not connect to the mail server, it uses the information already gathered by the mail collector itself. The plugin doesn't modify connection information...

@tomolimo One Question If the first email I am importing into GLPI is a "Email response", and if the first email does not exist in GLPI, it should open a new ticket ... correct?

This is correct. But, to be sure, you need to verify that the table glpi_plugin_mailanalyzer_message_id doesn't contains email id that may have been already input. To test, you can clear this table.

Thank you, Regards, Tomolimo

phamorais commented 3 years ago

Thanks, @tomolimo

However, how can we understand that by deactivating the plugin, the email is imported?

tomolimo commented 3 years ago

Hello @phamorais

Thanks, @tomolimo

However, how can we understand that by deactivating the plugin, the email is imported?

This I cannot say... There is something wrong in the plugin, but the logs don't show it. Could it be that there are some other logs? For example: sql-errors.log I need to be able to reproduce the complete flow of emails. Thank you Regards, Tomolimo

phamorais commented 3 years ago

@tomolimo

In other tests this log appeared

Laminas_mail

image

tomolimo commented 3 years ago

Hello @phamorais Did you empty the glpi_plugin_mailanalyzer_message_id table before sending again and again the same email into GLPI? As the plugin will prevent the integration if the reference of the email is present in this table... Thank you, Regards, Tomolimo

tomolimo commented 3 years ago

Hello @phamorais I made a new release of the plugin to fix an issue that was a wrong returned parameter, but I don't think it will fix your troubles. You may try it. Thank you, Regards, Tomolimo

phamorais commented 3 years ago

@tomolimo Hi!

I tested several things yesterday .. and realized the following:

1 - According to your guidance, I noticed that some emails I was testing already had the ID filled in "glpi_plugin_mailanalyzer_message_id". So, when I tried to import again, the email was not important but there was no message explaining the reason, and this generated many doubts. A suggestion that I give a new version of the plugin is that when there are cases when we are trying to import an existing email in the column "glpi_plugin_mailanalyzer_message_id" Receive the message in GLPI, similar to the image below (I don't know if it's possible).

image

2 - As I understand it, GLPI does not validate if the email ID already exists, so it always imported the email. It made me think that your plugin was wrong, but it wasn't.

I will install the new version of the plugin as suggested, thank you for the cordial service ever

tomolimo commented 3 years ago

Hello @phamorais Thank you for your feedback.

1 - According to your guidance, I noticed that some emails I was testing already had the ID filled in "glpi_plugin_mailanalyzer_message_id". So, when I tried to import again, the email was not important but there was no message explaining the reason, and this generated many doubts. A suggestion that I give a new version of the plugin is that when there are cases when we are trying to import an existing email in the column "glpi_plugin_mailanalyzer_message_id" Receive the message in GLPI, similar to the image below (I don't know if it's possible).

image

To understand the behavior of GLPI and of the plugin: in GLPI there is no way to interact with the mailcollector directly and to tell to it: don't create a ticket. The only way to prevent GLPI to create a ticket is to use a special hook called pre_item_add and to respond to this hook with "false" value. This unfortunately leads GLPI to think that the email was not imported -> the error you saw when importing email manually from the receiver, and in the list of emails you can see the "Failed Operation" which is wrong is this case.

2 - As I understand it, GLPI does not validate if the email ID already exists, so it always imported the email. It made me think that your plugin was wrong, but it wasn't.

Exactly, you are right.

Thank you, Regards, Tomolimo