User Tools

Site Tools


extensions:ticket-from-email

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
extensions:ticket-from-email [2019/04/23 11:59]
vdumas
extensions:ticket-from-email [2019/10/08 10:37] (current)
vdumas
Line 4: Line 4:
 description_wiki : Scan several mailboxes to create or update tickets. description_wiki : Scan several mailboxes to create or update tickets.
 index_hidden ​    : yes index_hidden ​    : yes
-version ​         : 3.0.17 +version ​         : 3.1.0 
-release_dt ​      : 2019-03-19+release_dt ​      : 2019-05-21
 itop-version-min : 2.3.0 itop-version-min : 2.3.0
 +download_url ​    : http://​www.combodo.com/​itop-extensions/​
 code             : combodo-mail-to-ticket-automation code             : combodo-mail-to-ticket-automation
 state            : stable state            : stable
Line 12: Line 13:
 alias-code_hidden : ticket-from-email alias-code_hidden : ticket-from-email
 alternate-name ​  : Ticket Creation from eMails alternate-name ​  : Ticket Creation from eMails
-module-lists_hidden : combodo-email-synchro/​3.1.3, itop-standard-email-synchro/​3.0.15+module-lists_hidden : combodo-email-synchro/​3.2.0, itop-standard-email-synchro/​3.1.0
 diffusion ​       : iTop Hub diffusion ​       : iTop Hub
 ---- ----
  
-<note warning>​**Compatibility issue**: for iTop version lower than 2.4.0, there is a [[installation#​itop_before_240|special installation/​upgrade process]].</​note>​ 
- 
-<note warning>​For iTop versions older than 2.3.0 use a previous version of this component</​note>​ 
 <​related_components>​Other versions of this component:</​related_components>​ <​related_components>​Other versions of this component:</​related_components>​
 +
 +
 +
 +
 +
 +
  
 ===== Summary ===== ===== Summary =====
Line 57: Line 61:
  
 ^  Release Date  ^  Version ​ ^  Comments ​ ^ ^  Release Date  ^  Version ​ ^  Comments ​ ^
 +|  2019-05-21 ​ |  3.1.0  | * Contacts in To/cc with the same email as current mailbox are not added to the ticket anymore \\                 * Handle signed emails with an "​enveloped format"​ \\                 * Store eml for all the messages |
 |  2019-03-19 ​ |  3.0.17 ​ | Dictionnaries internal updates | |  2019-03-19 ​ |  3.0.17 ​ | Dictionnaries internal updates |
 |  2019-03-13 ​ |  3.0.16 ​ | * Store eml for message in error \\ * Error log attached to the corresponding message | |  2019-03-13 ​ |  3.0.16 ​ | * Store eml for message in error \\ * Error log attached to the corresponding message |
Line 230: Line 235:
  
 <code php> <code php>
-  ​'​combodo-email-synchro'​ => array ( +   '​combodo-email-synchro'​ => array ( 
-         ​'​debug'​ => false, +      '​debug'​ => false, 
-         ​'​periodicity'​ => 30, +      '​periodicity'​ => 30, 
-         ​'​body_parts_order'​ => '​text/​html,​text/​plain',​ +      '​body_parts_order'​ => '​text/​html,​text/​plain',​ 
-         ​'​pop3_auth_option'​ => '​USER',​ +      '​pop3_auth_option'​ => '​USER',​ 
-         ​'​imap_options'​ => array ( +      '​imap_options'​ => array ( 
-                  0 => '​imap',​ +            0 => '​imap',​ 
-            ), +      ), 
-         ​'​exclude_attachment_types'​ => array ( +      '​exclude_attachment_types'​ => array ( 
-                  0 => '​application/​exe',​ +            0 => '​application/​exe',​ 
-            ), +      ), 
-         ​'​maximum_email_size'​ => '​10M',​ +      '​maximum_email_size'​ => '​10M',​ 
-         ​'​introductory-patterns'​ => array ( +      '​recommended_max_allowed_packet'​ => 10485760, 
-                  0 => '/^le .+ a écrit :​$/​i',​ +      ​'​introductory-patterns'​ => array ( 
-                  1 => '/^on .+ wrote:​$/​i',​ +            0 => '/^le .+ a écrit :​$/​i',​ 
-                  2 => '​|^[0-9]{4}/​[0-9]{1,​2}/​[0-9]{1,​2} .+:​$|',​ +            1 => '/^on .+ wrote:​$/​i',​ 
-            ), +            2 => '​|^[0-9]{4}/​[0-9]{1,​2}/​[0-9]{1,​2} .+:​$|',​ 
-         ​'​multiline-delimiter-patterns'​ => array ( +      ), 
-                  0 => '/​\\RFrom:​ .+\\RSent: .+\\R/​m',​ +      '​multiline-delimiter-patterns'​ => array ( 
-                  1 => '/​\\R_+\\R/​m',​ +            0 => '/​\\RFrom:​ .+\\RSent: .+\\R/​m',​ 
-                  2 => '/​\\RDe : .+\\R\\R?​Envoyé : /m', +            1 => '/​\\R_+\\R/​m',​ 
-                  3 => '/​\\RDe : .+\\RDate d\'​envoi : .+\\R/​m',​ +            2 => '/​\\RDe : .+\\R\\R?​Envoyé : /m', 
-                  4 => '/​\\R-----Message d\'​origine-----\\R/​m',​ +            3 => '/​\\RDe : .+\\RDate d\'​envoi : .+\\R/​m',​ 
-                  5 => '/​\\RExpéditeur:​ .+\\RDate:/​m',​ +            4 => '/​\\R-----Message d\'​origine-----\\R/​m',​ 
-                  6 => '/​\\RDe : .+\\RDate : /m', +            5 => '/​\\RExpéditeur:​ .+\\RDate:/​m',​ 
-                  7 => '/​\\TO:​.+\\RCC:/​m',​ +            6 => '/​\\RDe : .+\\RDate : /m', 
-            ), +            7 => '/​\\TO:​.+\\RCC:/​m',​ 
-         ​'​big_files_dir'​ => '',​ +      ), 
-         ​'​use_message_id_as_uid'​ => false, // Don't change this unless you know what you are doing! +      '​big_files_dir'​ => '',​ 
-         ​'​images_minimum_size'​ => '​100x20',​ +      '​use_message_id_as_uid'​ => false, // Don't change this unless you know what you are doing! 
-  '​images_maximum_size'​ => '',​ +      '​images_minimum_size'​ => '​100x20',​ 
-         ​'​undesired-subject-patterns'​ => array ( +      '​images_maximum_size'​ => '',​ 
-                  0 => '/^Out Of Office/​i',​ +      '​undesired-subject-patterns'​ => array ( 
-                  1 => '/​^Automatic answer$/​i',​ +            0 => '/^Out Of Office/​i',​ 
-                  2 => '/​^Réponse automatique:/',​ +            1 => '/​^Automatic answer$/​i',​ 
-            ), +            2 => '/​^Réponse automatique:/',​ 
-         ​'​undesired-purge-delay'​ => 7, +      ), 
-    ),+      '​undesired-purge-delay'​ => 7, 
 +      '​html-tags-to-remove'​ => array( 
 +           '​blockquote'​ => array(),  
 +           // No class specified, remove any blockquote tag 
 +           '​div'​ => array('​gmail_quote',​ '​moz-cite-prefix'​),​ 
 +           '​pre'​ => array('​moz-signature'​),​ 
 +      ); 
 +   ),
 </​code>​ </​code>​
  
Line 277: Line 289:
 | imap_options | Additional IMAP options. Possible values are listed here: [[http://​www.php.net/​manual/​en/​function.imap-open.php|IMAP flags]]. **Warning**:​ Do NOT use the ''​pop3''​ flag to connect to a POP3 mailbox using the PHP IMAP extension. Due to a limitation of the IMAP extension this will not work! If you want to connect to a POP3 server, use the POP3 protocol instead. | array('​imap',​ '​novalidate-cert'​) | | imap_options | Additional IMAP options. Possible values are listed here: [[http://​www.php.net/​manual/​en/​function.imap-open.php|IMAP flags]]. **Warning**:​ Do NOT use the ''​pop3''​ flag to connect to a POP3 mailbox using the PHP IMAP extension. Due to a limitation of the IMAP extension this will not work! If you want to connect to a POP3 server, use the POP3 protocol instead. | array('​imap',​ '​novalidate-cert'​) |
 | exclude_attachment_types | Array of MIME types to exclude when retrieving attachments | array('​application/​attachment'​) | | exclude_attachment_types | Array of MIME types to exclude when retrieving attachments | array('​application/​attachment'​) |
-| html-tags-to-remove | ** new in 3.0.0 ** Used for computing the "new part" of HTML messages by removing the specified tags. The syntax is an array of ''​tag_name''​ <​nowiki>​=></​nowiki>​ array of CSS class names. | +| html-tags-to-remove | ** new in 3.0.0 ** Used for computing the "new part" of HTML messages by removing the specified tags. The syntax is an array of ''​tag_name''​ <​nowiki>​=></​nowiki>​ array of CSS class names. | //see above// ​
-  array( +
-   '​blockquote'​ => array(),  +
-   // No class specified, remove any blockquote tag +
-   '​div'​ => array('​gmail_quote',​ '​moz-cite-prefix'​),​ +
-   '​pre'​ => array('​moz-signature'​),​ +
-  ); +
-+
 | maximum_email_size | If an incoming email is bigger than the specified size, the message will saved to the ''​big_files_dir''​ if it is configured and deleted from the inbox. A notification message will be sent to the administrator as for other "​errors"​ happening when processing the mail inbox. The size can be specified using the '​short'​ notation: 100K, 3M, 2G... If set to zero, no limit will be enforced... ​ with the risk of a PHP crash if there is not enough memory to decode an incoming email. | 10M | | maximum_email_size | If an incoming email is bigger than the specified size, the message will saved to the ''​big_files_dir''​ if it is configured and deleted from the inbox. A notification message will be sent to the administrator as for other "​errors"​ happening when processing the mail inbox. The size can be specified using the '​short'​ notation: 100K, 3M, 2G... If set to zero, no limit will be enforced... ​ with the risk of a PHP crash if there is not enough memory to decode an incoming email. | 10M |
-| introductory-patterns | **only for plain text emails** When computing the "new part" of a message, lines matching this pattern and preceding what looks like an "old part" of the message, are removed. Adapt this list to your localization… and favorite email client dialect. The pattern specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax. | <​code>​array ( +| introductory-patterns | **only for plain text emails** When computing the "new part" of a message, lines matching this pattern and preceding what looks like an "old part" of the message, are removed. Adapt this list to your localization… and favorite email client dialect. The pattern specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax. | //see above// | 
-  0 => '/^le .+ a écrit :$/i', +| multiline-delimiter-patterns | **only for plain text emails** Multi-line regular expression patterns used for computing the "new part" of a message. each of theses patterns determine the beginning of the "old part" of a message, when a message is a "​Reply"​ to another message. Everything that matches this pattern (and all the text that follows this match) will be removed for the "new part". All patterns are tested successively. The pattern that provides a match closer to the beginning of the text will be used. Adapt this list to your localization and to the dialect of your favorite email clients... The pattern specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax.| //see above// |
-  1 => '/^on .+ wrote:​$/​i',​ +
-  2 => '​|^[0-9]{4}/​[0-9]{1,​2}/​[0-9]{1,​2} .+:​$|',​  +
-)</code> ​+
-| multiline-delimiter-patterns | **only for plain text emails** Multi-line regular expression patterns used for computing the "new part" of a message. each of theses patterns determine the beginning of the "old part" of a message, when a message is a "​Reply"​ to another message. Everything that matches this pattern (and all the text that follows this match) will be removed for the "new part". All patterns are tested successively. The pattern that provides a match closer to the beginning of the text will be used. Adapt this list to your localization and to the dialect of your favorite email clients... The pattern specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax.| ​<code php>​array ( +
-  0 => '/\\RFrom: .+\\RSent: .+\\R/m', +
-  1 => '/\\R_+\\R/​m',​ +
-  2 => '/​\\RDe : .+\\R\\R?​Envoyé : /m', +
-  3 => '/​\\RDe : .+\\RDate d\'​envoi : .+\\R/​m',​ +
-  4 => '/​\\R-----Message d\'​origine-----\\R/​m',​ +
-  5 => '/​\\RExpéditeur:​ .+\\RDate:/​m',​ +
-  6 => '/​\\RDe : .+\\RDate : /m', +
-  7 => '/​\\TO:​.+\\RCC:/​m',​ +
-)</code> ​|+
 | big_files_dir | The path to a directory where to store emails bigger than ''​maximum_email_size''​. If this directory is not configured, the emails are simply deleted before notifying the administrator. |  | | big_files_dir | The path to a directory where to store emails bigger than ''​maximum_email_size''​. If this directory is not configured, the emails are simply deleted before notifying the administrator. |  |
 | use_message_id_as_uid | Boolean. For IMAP connections only. Whether or not to use the identifier from the message (MessageID) instead of the Mailbox'​ unique identifier (UID) to uniquely identify the already processed messages. This can be useful to workaround problems when the UID of the messages on the server changes between sessions (like with Gmail). If you toggle this value, make sure that you first empty the mailbox (and stop the cron job), since all messages present in the mailbox when the setting is changed will be considered as new and processed again. | false | | use_message_id_as_uid | Boolean. For IMAP connections only. Whether or not to use the identifier from the message (MessageID) instead of the Mailbox'​ unique identifier (UID) to uniquely identify the already processed messages. This can be useful to workaround problems when the UID of the messages on the server changes between sessions (like with Gmail). If you toggle this value, make sure that you first empty the mailbox (and stop the cron job), since all messages present in the mailbox when the setting is changed will be considered as new and processed again. | false |
Line 307: Line 299:
 | undesired-subject-patterns | An array of regular expression patterns (as PHP text strings) that will be used to test the subject of the incoming email. If any of these pattern matches, the email will be considered as "​undesirable"​ and rejected (the same processing as for any other error case will then be applied). The patterns specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax. | array() | | undesired-subject-patterns | An array of regular expression patterns (as PHP text strings) that will be used to test the subject of the incoming email. If any of these pattern matches, the email will be considered as "​undesirable"​ and rejected (the same processing as for any other error case will then be applied). The patterns specified here must follow the [[http://​www.php.net/​manual/​en/​reference.pcre.pattern.syntax.php|PCRE]] syntax. | array() |
 | undesired-purge-delay | Delay in days to remove automatically the undesired messages (0 means that the messages are removed immediately) | 7 | | undesired-purge-delay | Delay in days to remove automatically the undesired messages (0 means that the messages are removed immediately) | 7 |
 +| recommended_max_allowed_packet | Display a warning on the '​Mailbox Content'​ screen if the database parameter '​max_allowed_packet'​ is less than the one configured | 10*1024*1024 |
 <note important>​When specifying PCRE patterns inside the configuration file, make sure that you double the backslash characters, since backslashes must be escaped inside PHP litteral text strings.</​note>​ <note important>​When specifying PCRE patterns inside the configuration file, make sure that you double the backslash characters, since backslashes must be escaped inside PHP litteral text strings.</​note>​
  
Line 320: Line 313:
  
 ^  Parameter ​ ^  Meaning ​ ^  Default Value  ^ ^  Parameter ​ ^  Meaning ​ ^  Default Value  ^
-| ticket_log| An associative array (hash) defining, for each class of Ticket, the code of the attribute to set when updating a ticket from an incoming message. You don't need to change this value unless you modified the Data Model. | <​code>​array ( +| ticket_log| An associative array (hash) defining, for each class of Ticket, the code of the attribute to set when updating a ticket from an incoming message. You don't need to change this value unless you modified the Data Model. | //see above// ​|
-  '​ticket_log'​ => array ( +
-    '​UserRequest'​ => '​public_log',​ +
-    '​Incident'​ => '​public_log',​ +
-  ), +
-)</code>|+
  
 ====== Checking the connection ====== ====== Checking the connection ======
Line 331: Line 319:
 Once the Mail Inbox object has been created, you can use the tab "​Mailbox Content"​ in the details of the object to check that the application can properly connect to the mail server and retrieve messages from it. Once the Mail Inbox object has been created, you can use the tab "​Mailbox Content"​ in the details of the object to check that the application can properly connect to the mail server and retrieve messages from it.
  
-{{ :​extensions:​email-synchro-mailbox-content.png?​nolink&​600 |Mailbox Content tab}}+{{ :​extensions:​standard_mail_inbox.png?​nolink&​600 |Mailbox Content tab}}
  
 <note tip>To deeply inspect the content of the mailbox it is always better to use a real mail client application. The view provided in this tab is just use to help troubleshooting connection problems.</​note>​ <note tip>To deeply inspect the content of the mailbox it is always better to use a real mail client application. The view provided in this tab is just use to help troubleshooting connection problems.</​note>​
Line 339: Line 327:
   * "Reset Status":​ for messages which are either flagged as "​Error"​ or "​Already processed",​ this status will be reset and the email will considered again as "​New"​ and thus candidate for processing the next time cron.php runs.   * "Reset Status":​ for messages which are either flagged as "​Error"​ or "​Already processed",​ this status will be reset and the email will considered again as "​New"​ and thus candidate for processing the next time cron.php runs.
   * "​Delete eMail":​ deletes the message(s) from the mailbox. No confirmation will be asked !!   * "​Delete eMail":​ deletes the message(s) from the mailbox. No confirmation will be asked !!
 +  * "​Ignore eMail":​ mark new messages as "​ignored"​ to avoid processing them.
  
 ====== Debugging ====== ====== Debugging ======
  
-**New in 3.0.16**: Access to the eml used and to the message specific logs when the message triggers an error is now possible ​without activating the debug mode.+**New in 3.0.15**: Access to the eml used and to the message specific logs without activating the debug mode for every processed message.
  
  
Line 360: Line 349:
  
 <note warning>​__Known issue until 3.0.17 included__: When activating debug trace, logging trace may truncate an UTF8 character which breaks MySQL insertion and stop current email processing. Because of this, don't use this mode as a permanent mode, but only for temporary debug.</​note>​ <note warning>​__Known issue until 3.0.17 included__: When activating debug trace, logging trace may truncate an UTF8 character which breaks MySQL insertion and stop current email processing. Because of this, don't use this mode as a permanent mode, but only for temporary debug.</​note>​
 +
 +
 +===== Questions & Answers =====
 +
 +**Question: Mails are no more processed?​** \\
 +Answer: ​
 +  - It might be due to a email message with a too big attachment, which can end-up crashing the database. In that case, to quickly process the following emails, open the Mail Inbox in iTop, tab: Mailbox Content; identify the faulty email, probably the oldest "​new"​ message and check it and press the ''​Ignore''​ button.
 +  - To limit the above situation, check coherence between ''​allowed_max_packet'',​ ''​recommended_max_allowed_packet''​ and ''​maximum_email_size''​ parameters.
 +  - It might be due to the cron.php not running
 +
 +
 +**Question: a particular mail is in error, why?** \\
 +Answer: There can be multiple reasons, which leads to flagging a mail in error. When browsing the ''​Mailbox Content''​ tab on the ''​Incoming eMail Inboxes''​ the error message should explain you the reason. Attachment too big, mail in an unkown format (encrypted for eg.),...
 +
extensions/ticket-from-email.1556013553.txt.gz · Last modified: 2019/04/23 11:59 by vdumas

";