邮件自动创建工单

名称:邮件自动创建工单

描述:扫描多个邮箱以创建或更新票证。

版本:3.1.1

发布:2019-11-22

itop-version-min:2.3.0

码:组合邮件到工单的自动化

州:稳定

用名称:工单通过电子邮件创建

github-module1 1:https:github.commCombodoocombodo-email-synchro

github-module12:https:github.commCombodooitop-standard-email-synchro

扩散:iTop集线器

该组件的其他版本: 2.22.6.12

总结

该扩展程序在后台中运行,以扫描定义的邮件收件箱,并根据传入电子邮件的内容创建或更新票证。

在创建工单时,它会用发送邮件的内容填充工单的说明,设置呼叫人,客户,复制附件,添加联系人和许多其他字段…

在更新工单时,它将尽可能最佳地提取发送邮件的``最后答复''部分以更新工单的外部留言,复制附件,变更,工单的状况并添加联系人

特征

确定发件人是否是现有的Person(由其发送邮件找到),然后可以基于配置拒绝发送邮件中的发送邮件或创建新的Person。

确定是否必须根据iTop在发送邮件中添加的自定义标头(如果有回复)或标题中的可配置模式来创建或更新工单

使用POP3或IMAP协议连接到任何邮箱

邮件收件箱的交互式配置

流程以HTML或纯文本格式接收的电子邮件

支持事件和用户请求票证

工单的附件会自动转换为工单的附件(可以排除“危险”类型的附件)

自动检测重复的附件(例如签名图像)

已关闭,直到相应的工单被删除或被删除为止

如果处理发送邮件时发生错误,则手册重试

嵌入在HTML邮件中的图像也会在iTop中内嵌显示。

图像``太小''(低于可配置的尺寸)不会作为附件导入(以排除签名)

大于可配置尺寸的图像可以在上载到iTop之前自动调整大小

“内嵌图像”以缩小(可配置)的大小显示,并且可以通过单击它们来“放大”。

根据要针对发送邮件的主题进行测试的一组可配置模式,自动拒绝“自动答复”电子邮件

将发送邮件的其他收件人(收件人:和CC :)添加为工单上的其他联系人(可配置)。联系人必须已经与确切的发送邮件存在,将不会创建它,而只是链接到发送邮件。

收到工单时,对变更和工单的状态施加激励(在工单的状态上可配置,依赖)。

添加新的触发器类型:触发器(通过邮件更新时),允许通过接收到的发送邮件通知工单更新的时间。

如果要限制通知'创建对象'(在对象上),限制为由发送邮件创建的工单,请在OQL中使用触发器='发送邮件'。

修订记录

发布日期版本注释
2019-11-223.1.1*与iTop 2.7的兼容性
*通过Outlook修复错误的编码非中断空间
*更新DE翻译
*从引用检查传入的发送邮件的ID
2019-05-213.1.0* Toocc中与当前邮箱相同的发送邮件中的联系人不再添加到工单中
*以“信封格式”处理签名的电子邮件
*存储所有消息的eml
2019-03-193.0.17字典内部更新
2019-03-133.0.16*在错误中存储eml以获取消息
*错误日志附有相应的消息
2018-12-193.0.15*更新西班牙语翻译(感谢Miguel Turrubiates)
* JQuery兼容性(自iTop 2.6起的JQuery 3)
*修复用于设置呼叫人_id的OQL(感谢Jeffrey!SF#1628)
*修复无效的ES词典(“ U-8字符格式错误”错误)
*当未配置任何刺激时,修复不必要的轨迹“刺激”配置中的无效行
2018-06-273.0.14添加DE翻译
2018-03-013.0.13修复某些电子邮件上的损坏(二进制)附件(无UTF8电子邮件和错误的内容传输编码格式)。
2018-02-213.0.12启用2.5.0菜单覆盖功能。
2018-02-063.0.11修复未正确指定内容处置时存储为嵌入式图像的附件。
2018-02-053.0.10修复版本3.0.8中损坏的PHP 5.3兼容性
2018-01-293.0.9使用OQL允许触发器到过滤器
2018-01-253.0.8垃圾邮件标记为“不需要”,并在延迟后删除。在“未知呼叫人”的情况下,可以发送通用发送邮件答复。更新俄语翻译
2017-08-283.0.7CSV导入期间重复的字典条目发生冲突(归因于MailInboxStandard类的行为和error_behavior)。
2017-03-313.0.6如果无法将EmailReplica错误消息持久保存到DB中(例如,带有4个字节的Unicode字符),则该消息将引发致命的错误。现在,当无法保留默认错误消息时,我们将其保存,并将原始消息转储到IssueLog中。
2016-11-103.0.5现在支持几个MailInbox扫描一个发送邮件地址邮箱,只要它们具有不同的文件夹(Mailbox(用于IMAP)属性)。另外,修复了3.0.x中引入的回归问题,use_message_id_as_uid配置参数不再起作用。
2016-10-053.0.4在Lotus Notes发出的消息中支持嵌入式图像。
2016-08-263.0.3修复了3.0.x中引入的回归:应用刺激无效。当发件人未知时(如果是工单更新),CRON被致命的错误中断。如果目标字段为纯文本,则为空描述。如果发送邮件是纯文本格式(使用雷鸟创建的发送邮件,并且没有富文本格式),则在案例日志中丢失CR
2016-08-093.0.2如果未安装某些先决条件(PEAR或IMAP),请确保安装程序不会崩溃。
2016-07-263.0.1支持向工单添加更多联系人(收件人:和抄送:)。当收到工单的更新时,能够施加激励(对变更的状态为工单的状态)。
2016-06-072.6.12安全:只有管​​理员才能看到邮件收件箱的密码。回归:正确导入所有附件(如果不是图像,则不只是最后一个附件)。增强功能:从HTML转换为纯文本时保留超链接。
2016-02-022.6.11仅限开发人员:修复了模块itop-standard-email-synchro.的替代品的兼容性问题。回归已在2.6.6中引入,除非您已开发出itop-标准-发送邮件-同步的替代产品,否则影响度的行为并不影响度的。
2015-10-282.6.10自动拒绝“自动回复”电子邮件(请参见下面的不需要的主题模式)。支持无主题的电子邮件。
2015-09-292.6.9正确初始化ENUM值(#1102),防止更新与邮件收件箱中配置的票证不同类的票证。
2015-03-092.6.8修复了images_maximum_size参数的处理,以防止在不调整图像大小时发生错误。修复了检测HTML回复中的blockquote标签的模式。
2015-03-052.6.7忽略小图像时禁止显示警告。变更是“ body_parts_order”的默认价值。
2015-01-212.6.6支持内联图像,“太小”图像的过滤和“大”图像的大小调整。
2014-08-012.6.5新的配置参数至变通方案以及带有GmaillIMAP的问题。
2014-07-212.6.4增强功能:允许在处理电子邮件后立即从服务器删除电子邮件。 “ TriggerOnMailUpdate”的法语翻译,并使触发器可导入。
2014-06-042.6.3增强功能:支持创建变更和问题票证。
2014-04-092.6.2错误修复,以支持名称中包含反斜杠的邮箱(可能使用IMAP发生)。
2014-04-082.6.1增加德语本地化(尽管不是100%翻译)。
2014-03-052.6.0改进了错误的处理(例如,保留邮箱中的错误,重试手册),并在回复消息时更好地解码了消息的“新部分”。增强HTML到文本的转换,修复了“ Outlook的转发邮件”作为附件的处理。
n/a2.5支持多个邮件收件箱。通过iTop用户界面的邮件收件箱的交互式配置。电子邮件的解析解码的各种改进
2013-07-222.2“原有”版本仅支持一个邮箱(从iTop配置文件配置)。该版本的文档可在这里找到:通过电子邮件创建工单(原有)

要求

PHP 5.2.1+和IMAP扩展如果要连接到IMAP服务器,则启用此功能,或者梨::网络插座(iTop随附其自己的PEAR :: POP3副本)如果要连接到POP3服务器。

使用有效邮箱到POP3或IMAP服务器的连接。

cron.php文件必须正在运行才能启用传入电子邮件的处理。

对于调试跟踪,PHP的MBString必须安装。

要调整大图的大小,菲律宾盾必须安装。

在 Ubuntu 16.04 上,可以使用 php-pear、php-net-socket 和 php-imap 包安装先决条件:

sudo apt-get install php-pear php-net-soc

安装和升级

在iTop的“扩展”文件夹中展开zip文件的内容。

兼容性问题:对于低于2.4.0的iTop版本,有一个特殊安装/升级流程.

确保Web服务器具有足够的权利来读取“扩展”文件夹中的所有文件。

启动安装程序,并在提示您输入要安装的扩展的列表时,从列表中选中“邮件自动创建工单”

在Ubuntu(16.04之前的版本)上使用IMAP:软件包php5-imap不启用IMAP模块。要在Ubuntu上使用IMAP模块,必须先安装它,然后显式启用它:

sudo apt-get install php5-imap
sudo php5enmod imap

无论如何,您可能需要重新启动Web服务器才能将新安装的软件包放入账号:

sudo service apache2 restart

用法

数据映射

从传入的发送邮件消息创建新的工单时,应用自动填充工单的以下字段:

题=邮件主题

明=邮件正文

叫人(caller_id)=邮件的发件人(由发送邮件地址标识)

织((org_id)=呼叫人的组织

源(如果工单上存在此字段)='mail'

必须通过“工单默认值”设置为工单的任何其他必填字段提供默认(即常量)值,否则工单的创建将失败。

更新现有的工单时,应用会将条目的“新部分”添加到公众_log字段(可配置,请参见下文)中。有关如何从消息中提取“新零件”的更多说明,请参见下文。

指定默认值

用于指定默认值的语法如下:

语法每行一个字段:

field_code:default_value

如果要初始化的字段是另一个对象的键(对于org_id,服务_id等字段),则可以指定目标对象的数字标识符(e.g. service_id:153)或其名称(e.g. org_id:Demo),只要名称是唯一的。

默认值在上述标准数据映射之后应用。因此,可以使用一些常量值覆盖默认的数据映射。

如果传入的发送邮件没有主题,则可以通过“默认标题(如果主题为空)”字段指定要为工单设置的默认标题。这与上面列出的默认值不同,因为仅当发送邮件没有主题时才使用此价值。如果“默认标题(如果主题为空)”,那么发送邮件将为系统一个默认的价值(“无主题”),因为标题是创建工单所必需的。

配置

可通过“管理工具”部分中的“传入发送邮件收件箱”菜单来管理每个邮箱的行为(向流程发送消息以及是否创建或更新工单):

https://www.itophub.io/wiki/media?media=extensions%3Aemail-synchro-menu.png

单击“创建新的邮件收件箱”以为邮件收件箱创建新的配置。这将显示以下表单:

New mail inbox

邮箱配置

“邮箱配置”定义了应用如何连接到邮件收件箱:

领域含义样品价值
邮件服务器邮件服务器的IP地址或标准主机名10.153.20.142或pop3.mycompany.com
登录名用于连接到邮箱的邮件账号的名称test@mycompany.com
密码上述账号的密码 
协议连接到邮件服务器的协议:POP3或IMAP。
如果需要将IMAP与SSL或TLS一起使用,请参阅下面的imap_options配置参数。
POP3
港口连接到服务器的TCP端口。对于POP3,标准值为110(安全:995),对于IMAP,标准值为143(安全:993)110
邮箱(用于IMAP)IMAP邮箱(文件夹)用于扫描传入的邮件。如果省略,将扫描默认(根)邮箱。使用POP3协议时,将忽略此选项。收 件 箱。文件夹.子文件夹
活性如果设置为“是”,将对收件箱进行轮询。否则没有。
调试跟踪使用此设置可跟踪与此收件箱相关的所有后台操作,以进行调试和故障排除。不建议长时间在生产中激活此选项,因为它会生成大量的输出,从而减慢服务器的速度。没有

错误中的电子邮件

本部分定义了无法正确处理传入的发送邮件时的行为。发送邮件可以保存在邮箱中(并记住为“错误”,并且不再进行处理),也可以立即从邮箱中删除。此外,原始消息可以与有关发送邮件的原因的某些说明一起转发到管理员(作为附件)。

领域含义样品价值
行为用错误处理的电子邮件是否应保留在邮箱中。如果是这样,该邮件将被标记为“错误”,不再处理,但仍可从邮箱中读取。将邮件保留在邮箱中
转发电子邮件至当发生发送邮件时,将发送邮件转发到的发送邮件地址。转发的消息包含有关发送邮件和原始发送邮件作为附件的一些说明。如果将此地址留空,则无法处理的传入电子邮件将直接从收件箱中删除,而无需另行通知。itopadmin@mycompany.com
(从)用作错误通知的“发送者”的IP地址。由于安全的原因,如果发件人地址不是已知地址,则许多邮件服务器不会中继邮件。itopadmin@mycompany.com

传入电子邮件的行为

本部分定义了应用在处理传入电子邮件时的行为。

领域含义样品价值
行为当新邮件到达收件箱时的行为。可能的值为:
创建或更新:如果找到匹配的工单,则创建一个新的工单或更新现有的工单
创建新的工单:每个新消息都会创建一个新的工单
更新现有票证:与现有工单不匹配的所有传入消息均被视为错误。
建立或更新
处理完发送邮件成功处理传入的发送邮件之后要采用的性能或绩效:将发送邮件保留在邮件服务器上(直到关联的工单为已关闭或删除),或者立即删除发送邮件。将发送邮件保留在邮件服务器上
工单类别收到发送邮件时要创建或更新的票证类别。确保为iTop配置选择有效的类。用户请求
工单默认值“工单默认值”和“新人的默认值”的语法是:
-每行初始化一个字段
--<field_code>:<constant_value>
service_id:联网
默认标题(如果主题为空)如果传入的发送邮件的主题为空,则用作工单的标题的价值。如果将此字段保留为空,则系统将为供应默认价值(“无主题”)空主题
标题模式应用发送的每个通知在发送邮件的MessageID字段中都包含一个引用到“源”工单。发送邮件客户应用程序通常将此标识符存储在答复发送邮件的“ in-reply-to”或“ references”标头中。这是识别发送邮件消息与发送邮件相关的主要方法。如果传入消息中不存在此标头,则应用可以解析“主题”字段以查找给定的匹配项。此模式确定如何解析主题。此处指定的模式必须遵循聚四氟乙烯 语法。/R-([0-9]{6})/
刺激申请state_code:stimulus_code的列表(每行一个),用于定义针对工单的给定状态要应用的激励(在更新工单之后)。例如,这对于自动重新分配处于“挂起”状态的工单很有用。待处理:ev_assign

未知来电者

当发送邮件的发送者(发件人:)与应用中的已知发送邮件地址不对应时,本部分确定应用的行为。有两种可能性:

拒绝发送邮件:传入的发送邮件被视为错误,因此被转发到管理员或被删除。

创建一个新人:将基于发件人的发送邮件和下面定义的常数创建一个新的Person。

领域含义样品价值
呼叫人未知的情况下的行为当传入发送邮件消息的发件人与应用中记录的任何人都不对应时该怎么办创建一个新人
未知呼叫人拒绝回复当未知的呼叫人行为设置为“拒绝发送邮件”时,对发件人的可选回复(留空时不发送消息)空的
新人的默认值用于初始化新Person的默认值。应用会自动使用邮件发送者的发送邮件地址填充发送邮件字段。所有其他必填字段必须使用此处提供的常量值进行初始化,否则新Person的创建将失败。first_name:Unknown
name:Caller
org_id:Demo

其他联系人的行为

本部分确定应用与传入发送邮件的其他收件人(邮件的“收件人”和“抄送”中的人)的行为。可以指定何时将与iTop中有效的联系人对应的发送邮件地址添加到工单中(通过``联系人''选项卡)。始终忽略与iTop中的有效联系人不对应的发送邮件地址。

领域含义样品价值
添加更多联系人(收件人,抄送)是否添加到:和抄送:发送邮件作为工单的附加联系人。可能的值为:
*永远不会:不会添加其他联系人
*始终:创建和更新工单时将添加其他联系人
*当创建工单时:仅在创建新的工单时才添加其他联系人
*当更新工单时:仅当更新现有工单时才会添加其他联系人
决不

其他参数配置

除了通过使用应用的用户界面创建邮件收件箱对象来执行配置之外,配置文件中还提供了一些参数来完善调优的行为。

下列参数适用于所有邮件收件箱

对于配置参数body_parts_order推荐的价值istextthtml,texttplain。实际上,为了正确地对嵌入HTML email中的图像进行导入处理,必须处理发送邮件的HTML版本而不是纯文本版本。

'combodo-email-synchro' =>  (
      'debug' => false,
      'periodicity' => 30,
      'body_parts_order' => 'text/html,text/plain',
      'pop3_auth_option' => 'USER',
      'imap_options' =>  (
            0 => 'imap',
      ),
      'exclude_attachment_types' =>  (
            0 => 'application/exe',
      ),
      'maximum_email_size' => '10M',
      'recommended_max_allowed_packet' => 10485760,
      'introductory-patterns' =>  (
            0 => '/^le .+ a écrit :$/i',
            1 => '/^on .+ wrote:$/i',
            2 => '|^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} .+:$|',
      ),
      'multiline-delimiter-patterns' =>  (
            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',
      ),
      'delimiter-patterns' =>  (
            '/^>.*$/' => false,  // "false" remove only the line, "true" remove the rest of the message
      ),
      'big_files_dir' => '',
      'use_message_id_as_uid' => false, // Don't change this unless you know what you are doing!
      'images_minimum_size' => '100x20',
      'images_maximum_size' => '',
      'undesired-subject-patterns' =>  (
            0 => '/^Out Of Office/i',
            1 => '/^Automatic answer$/i',
            2 => '/^Réponse automatique:/',
      ),
      'undesired-purge-delay' => 7,
      'html-tags-to-remove' => (
           'blockquote' => (), 
           // No class specified, remove any blockquote tag
           'div' => ('gmail_quote', 'moz-cite-prefix'),
           'pre' => ('moz-signature'),
      );
 
   ),
参数含义默认价值
调试设置为true以打开调试输出false
周期性检查传入消息的时间间隔(以秒为单位)30
body_parts_order以逗号分隔的,有序的MIME类型列表,确定要填充的消息的首选部分,以填充工单的描述或public_log。为了将嵌入在HTML中的图像作为导入的嵌入式图像,必须在优先级的文本部分上处理发送邮件的HTML部分。因此,推荐的配置是text/html,text/plain。text/html,text/plain
pop3_auth_optionsPOP3身份验证选项。可能的值为:'CRAM-MD5','APOP','PLAIN','登录名','用户'USER
imap_options其他IMAP选项。可能的值在这里列出:IMAP标志.
例如,要使用SSL,您可以指定:数组(0⇒'imap',2⇒'ssl')
警告:请勿使用PHP3扩展名使用pop3标志连接到POP3邮箱。由于IMAP扩展程序的限制,因此无法使用!如果要连接到POP3服务器,请改用POP3协议。
array('imap')
exclude_attachment_types检索附件时要排除的MIME类型数组array('application/attachment')
html-tags-to-remove3.0.0中的新功能。用于通过删除指定的标签来计算HTML消息的``新部分''。语法是tags_name => CSS类名数组。see above
maximum_email_size如果传入的发送邮件大于指定的大小,则该消息将被保存到big_files_dir中(如果已配置并从收件箱中删除)。与处理邮件收件箱时发生的其他“错误”一样,通知消息将发送到管理员。大小可以使用“短”符号指定:100K,3M,2G ...如果设置为零,则没有限制……如果没有足够的内存来解码传入的发送邮件,则PHP崩溃的风险。10M
introductory-patterns适用于纯文本电子邮件。在计算邮件的``新部分''时,将删除与该模式匹配且在邮件的``旧部分''之前的行。将此列表调整为适合您的本地化…和常用发送邮件客户方言。此处指定的模式必须遵循聚四氟乙烯 语法。see above
multiline-delimiter-patterns用于纯文本电子邮件,仅用于工单更新的邮件。多行常规表达式模式用于计算消息的“新部分”。当一条消息是对另一条消息的“答复”时,这些模式中的每一个都确定消息的“旧部分”的开始。与此模式匹配的所有内容(以及此匹配之后的所有文本)都将被删除,成为“新零件”。所有模式都将连续测试。将使用提供更接近文本开头的匹配项的模式。根据您的本地化和常用发送邮件客户端的方言调整此列表。模式必须遵循聚四氟乙烯 语法。see above
delimiter-patterns适用于纯文本电子邮件,并且仅适用于工单更新的邮件。如果没有multiline-delimiter-patterns匹配的情况,此常规表达式模式用于检测消息的“旧部分”开头的行。模式必须遵循聚四氟乙烯 语法。see above
big_files_dir存放大于maximum_email_size的电子邮件的目录路径。如果未配置此目录,则仅在通知管理员之前删除电子邮件。 
use_message_id_as_uid布尔值。仅适用于IMAP连接。是否使用消息中的标识符(MessageID)而不是邮箱的唯一标识符(UID)来唯一标识已处理的消息。当服务器上的邮件的UID在会话之间更改时(例如使用Gmail),这对于变通方案问题很有用。如果切换此价值,请确保首先清空邮箱(并停止cron作业),因为更改设置后邮箱中存在的所有邮件将被视为新邮件并再次处理。false
images_minimum_size导入图像的最小尺寸。小于给定尺寸的图像将被忽略,并且不会作为附件导入。尺寸表示为string width x height(其中width和height是整数,以像素为单位)。100×20
images_maximum_size大于这些尺寸(例如1000×1000)的图像将被调整大小以适合给定尺寸。尺寸以字符串width x height表示(其中width和height是整数,以像素为单位)。注意仅当安装了PHP GD时此特性才可用。如果没有给出尺寸,则图像永远不会调整大小。 
undesired-subject-patterns一组常规表达式模式(作为PHP文本字符串),这些模式将用于测试传入发送邮件的主题。如果这些模式中的任何一个匹配,则发送邮件将被视为“不合需要的”并被拒绝(然后将采用与任何其他发送邮件情况相同的处理)。此处指定的模式必须遵循聚四氟乙烯 语法。array()
undesired-purge-delay延迟天数以自动删除不需要的消息(0表示立即删除消息)7
Recommendation_max_allowed_pa​​cket如果数据库参数'max_allowed_pa​​cket'小于配置的值,则在“邮箱内容”屏幕上显示警告。10*1024*1024

在配置文件中指定PCRE模式时,请确保将反斜杠字符加倍,因为必须在PHP乱码文本字符串中对反斜杠进行转义。

'itop-standard-email-synchro' =>  (
                'ticket_log' =>  (
                          'UserRequest' => 'public_log',
                          'Incident' => 'public_log',
                        ),
        ),
参数含义默认价值
ticket_log一个关联数组(哈希),用于为工单的每个类定义在从传入消息更新工单时要设置的属性的代码。除非您修改了数据模型,否则不需要变更或价值。see above

故障排除

局限性

配置的每个邮件收件箱都对应一种类型的工单(即用户请求或突发事件,但不能同时兼有)。

通过php IMAP扩展名连接到POP3邮箱不起作用。在这种情况下,您必须通过PEAR :: NetSocket使用POP3配置。

没有验证邮件收件箱的目标类是iTop中的现有类。 (即,如果未安装事件管理模块,请不要尝试创建事件)。

仅当发送邮件零件的首选顺序配置为“ text/html,text/plain”(即HTML优先)时才支持嵌入式图像,这是所有新安装的默认设置。

在处理被视为对工单的更新的发送邮件时,扩展尝试提取消息的“新部分”(不包括先前消息中的内容)。但是,关于答复格式的依赖(其本身取决于所使用的发送邮件发送邮件软件)可能无法以可靠的方式提取此信息。在这种情况下,将使用发送邮件的全文。不幸的是,广泛使用的MS Outlook是此类发送邮件软件的示例,在该软件中,无法可靠地识别答复。有关如何调整此行为的说明,请参阅配置参数。

检查连接

一旦创建了邮件收件箱对象,就可以使用对象详细信息中的“邮箱内容”选项卡来检查应用是否可以正确连接到邮件对象并从中检索消息。

Mailbox Content tab

要深入检查邮箱的内容,最好使用真实邮件客户应用。此选项卡中提供的视图仅用于帮助解决连接问题。

该视图还允许对一组消息执行两种不同类型的操作活动:

  • “重置状况”:对于标记为“错误”或“已处理”的消息,此状况将被重置,而发送邮件将再次被视为“新”,因此是下次cron.php运行时的候选处理。
  • “删除发送邮件”:从邮箱中删除邮件。没有确认将被要求!
  • “忽略发送邮件”:将新消息标记为“已忽略”以避免处理它们。

调试

3.0.15中的新增功能:无需激活每个已处理消息的调试模式,即可访问所使用的eml和消息特定的日志。

由于在后台中处理传入的电子邮件,因此并不总是很容易理解当未按预期处理工单时会发生什么。为了跟踪此后台任务的执行,可以使用几种级别的跟踪:

通过将“调试跟踪”字段设置为“是”,在处理邮箱时将生成更多跟踪。此跟踪将转到cron作业的输出,并且还将在数据库中捕获(限制为256 KB)。捕获的跟踪在邮件收件箱对象的“调试跟踪”选项卡中可见。

可以在配置文件中将模块compbodo-发送邮件-同步的配置设置调试设置为true。这将激活所有已配置邮件收件箱的更多跟踪。此附加跟踪仅出现在cron作业的配置中。

可以将cron作业传递给可选的参数--verbose = 1来为所有后台任务激活一些调试跟踪。此附加跟踪也进入了cron作业的输出中。

如果CTC作业尚未在后台中运行,则可以方便地从命令行手动运行它,以查看发生了什么情况:

php cron.php --auth_user=<user> --auth_pwd=<pwd> --verbose=1

Debug trace tab

包括3.0.17之前的已知问题:激活调试跟踪时,日志记录跟踪可能会截断UTF8字符,这会破坏MySQL的插入并停止当前的发送邮件处理。因此,请勿将此模式用作永久模式,而只能用于临时调试。

问题和答案

题:邮件不再处理了吗?
回答:

可能是由于发送邮件消息的附件太大,最终可能导致数据库崩溃。在这种情况下,要快速流程以下电子邮件,请在iTop选项卡中打开“邮件收件箱”:找出有问题的发送邮件,可能是最早的``新''消息并进行检查,然后按``忽略''按钮。

为了限制上述情况,请检查allowed_max_packet,recommended_max_allowed_pa​​cket和maximum_email件_size参数之间的一致性。

可能是由于cron.php没有运行

题:错误中有特定的邮件,为什么?
回答:可能有多种原因,这导致在错误中标记邮件。浏览``传入的发送邮件收件箱''上的``邮箱内容''选项卡时,错误消息应向您说明原因。附件太大,邮件格式未知(例如已加密),…

原文:https://www.itophub.io/wiki/page?id=extensions%3Aticket-from-email


Mail to ticket automation

name:
Mail to ticket automation
description:
Scan several mailboxes to create or update tickets.
version:
3.1.1
release:
2019-11-22
itop-version-min:
2.3.0
code:
combodo-mail-to-ticket-automation
state:
stable
alternate-name:
Ticket Creation from eMails
diffusion:
iTop Hub

Other versions of this component: 2.22.6.12

Summary

This extension runs in the background to scan the defined mail inbox(es) and either create or update tickets based on the content of the incoming emails.

  • On Ticket creation, it fills the description of the ticket with the content of the email, set the caller, the customer, copy attachments, add contacts and many other fields…

  • On Ticket update, it extracts as best as possible, the last reply part of the email to update the Public Log of the ticket, copy attachment, change the status of the ticket and add contacts

Features

  • Determine if the sender is an existing Person (found by its email), then based on configuration it can reject the email in error or create a new Person.

  • Determines whether a Ticket must be created or updated based either on the custom headers added by iTop in the eMail (in case of replies) or based on a configurable pattern in the title

  • Connect to any mailbox using either the POP3 or IMAP protocol

  • Interactive configuration of the mail inboxes

  • Processes the incoming eMails in both HTML or plain text format

  • Support both Incidents and User Request tickets

  • Ticket's attachments are automatically turned into attachments of the Ticket (“dangerous” types of attachments can be excluded)

  • Automatic detection of duplicate attachments (like signature images)

  • Keeps the messages in the mailbox until the corresponding Ticket is either closed or deleted

  • Manual retry in case an error occurs when processing an eMail

  • Images embedded inside an HTML mail are displayed inline in iTop as well.

  • Images “too small” (below configurable dimensions) are not imported as attachments (to exclude signatures)

  • Images bigger than configurable dimensions can be resized automatically before uploading into iTop

  • “Inline images” are displayed at a reduced (configurable) size and can be “zoomed-in” by clicking on them.

  • Automatically reject “Autoreply” emails, based on a set of configurable patterns to be tested against the subject of the email

  • Add the other recipients of the email (To: and CCemoticon_smile as additional contacts on the ticket (configurable). The contact must already exist with that exact email, it won't be created, just linked to the Ticket..

  • Apply a stimulus (configurable, depending on the state of the ticket) to change the state of the ticket upon reception of an email.

  • Add a new type of Trigger: Trigger (when updated by mail) which allow to notify when a Ticket is updated through a received email.

If you want to trigger a Notification '(on object creation)' limited to Ticket created by email, use origin='email' in the OQL.

Revision History

Release DateVersionComments
2019-11-223.1.1* Compatibility with iTop 2.7
* Fix bad encoded non breaking space by outlook
* Update DE translations
* ID for incoming email are checked from reference
2019-05-213.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-193.0.17Dictionnaries internal updates
2019-03-133.0.16* Store eml for message in error
* Error log attached to the corresponding message
2018-12-193.0.15* Update spanish translations (Thanks to Miguel Turrubiates)
* JQuery compatibility (JQuery 3 since iTop 2.6)
* Fix OQL used to set caller_id (thanks Jeffrey ! SF#1628)
* Fix invalid ES dictionary (“UTF-8 Characters Malformed” error)
* Fix unnecessary trace 'invalid line in the “stimuli” configuration' when no stimulus is configured
2018-06-273.0.14Add DE translation
2018-03-013.0.13Fix corrupted (binary) attachments on some emails (none UTF8 emails and wrong content-transfer-encoding format).
2018-02-213.0.12Enable 2.5.0 menu overriding capabilities.
2018-02-063.0.11Fix attachments stored as inline images when content-disposition was not specified correctly.
2018-02-053.0.10Fix PHP 5.3 compatibility broken in revision 3.0.8
2018-01-293.0.9Allow trigger to filter with an OQL
2018-01-253.0.8SPAM messages flagged as 'undesired' and deleted after a delay. An generic email reply can be sent in case of 'Unknown caller'. Update Russian translation
2017-08-283.0.7Duplicated dictionary entries collision during CSV import (attributes behavior and error_behavior from MailInboxStandard class).
2017-03-313.0.6EmailReplica error message would throw a fatal error if it could not be persisted to DB (eg. With 4 bytes unicode characters). We now save a default error message when it is not possible to persist it, and we dump the original message in the IssueLog.
2016-11-103.0.5Now supports several MailInbox scanning a single email address mailbox, as long as they have distinct folders (Mailbox (for IMAP) property). Also, fixed a regression introduced in 3.0.x, use_message_id_as_uid configuration parameter was not working anymore.
2016-10-053.0.4Support of inline images in messages issued by Lotus Notes.
2016-08-263.0.3Fixed regressions introduced in 3.0.x: Apply stimulus not working. CRON interrupted by a fatal error when the sender is unknown (in case of a ticket update). Empty description if the target field is in plain text. Losing CR in the case log if the email is in plain text (email created with thunderbird, and no rich text formatting)
2016-08-093.0.2Make sure that the setup does not crash if some of the prerequisites (PEAR or IMAP) are not installed.
2016-07-263.0.1Support of adding more contacts (To: and CCemoticon_smile to the ticket. Ability to apply a stimulus (to change the state of a ticket) when receiving an update by email.
2016-06-072.6.12Security: only administrators can see the password of mail inboxes. Regression: properly import all attachments (not only the last one if it's not an image). Enhancement: preserve hyperlinks when converting from HTML to plain text.
2016-02-022.6.11Developers only: fixed a compatibility issue with alternatives to the module itop-standard-email-synchro. The regression has been introduced in 2.6.6 and does not impact the behavior of the component unless you have developped your own alternative to itop-standard-email-synchro.
2015-10-282.6.10Automatically reject “Autoreply” emails (cf undesired-subject-patterns below). Support of emails with no subject.
2015-09-292.6.9Properly initialize ENUM values (#1102), prevent updating tickets of a different class than the one configured in the mail inbox.
2015-03-092.6.8Fixed the processing of the images_maximum_size parameter to prevent errors when the images are not to be resized. Fixed the pattern for detecting blockquote tags inside HTML replies.
2015-03-052.6.7Suppressed a warning when ignoring small images. Change the default value for “body_parts_order”.
2015-01-212.6.6Support of inline images, filtering of “too small” images and resizing of “big” images.
2014-08-012.6.5New configuration parameter to workaround a problem with Gmail/IMAP.
2014-07-212.6.4Enhancement: allow to delete the emails from the server immediately after processing them. French translation of the “TriggerOnMailUpdate” and make the trigger importable.
2014-06-042.6.3Enhancement: support the creation of Change and Problem tickets.
2014-04-092.6.2Bug fix in order to support mailboxes containing a backslash in their name (likely to happen using IMAP).
2014-04-082.6.1Addition of the German localization (though it's not 100% translated).
2014-03-052.6.0Improved error processing (e.g. keeping the errors in the mailbox, manual retry) and better decoding of the “new part” of the message when it is a reply. Enhanced HTML to text conversion, fixed the processing of “Outlook's forwarded messages” as attachments.
n/a2.5Support of several mail inboxes. Interactive configuration of the mail inboxes via the iTop user interface. Various improvements for the parsing/decoding of the eMails
2013-07-222.2“Legacy” version supporting only one mailbox (configured from the iTop configuration file). The documentation for this version is available here: Ticket Creation from eMails (legacy)

Requirements

  • PHP 5.2.1+ with the IMAP extension enabled if you want to connect to an IMAP server, or PEAR::NetSocket (iTop comes with its own copy of PEAR::POP3) if you want to connect to a POP3 server.

  • A connection to a POP3 or IMAP server with a valid mailbox.

  • cron.php must be running to enable the processing of incoming eMails.

  • For the debug trace, PHP MBString must be installed.

  • For resizing big images, PHP GD must be installed.

On Ubuntu 16.04 the prerequisites can be installed using the php-pear, php-net-socket and php-imap packages:

sudo apt-get install php-pear php-net-socket php-imap

Installation & upgrade

  • Expand the content of the zip file in the “extensions” folder of iTop.

Compatibility issue: for iTop version lower than 2.4.0, there is a special installation/upgrade process.

  • Make sure that the web server has enough rights to read all the files in the “extensions” folder.

  • Launch the setup program, and when prompted for the list of extensions to install, check “Mail to ticket automation” from the list

Using IMAP on Ubuntu (prior to 16.04): the package php5-imap does not enable the IMAP module. To use the IMAP module on Ubuntu you must install it and then enable it explicitly:

sudo apt-get install php5-imap
sudo php5enmod imap

In any case, you may need to restart the web server to take into account the newly installed packages:

sudo service apache2 restart

Usage

Data Mapping

When creating a new ticket from an incoming email message, the application automatically fills the following fields of the ticket:

  • Title = subject of the mail

  • Description = body of the mail

  • Caller (caller_id) = sender of the mail (identified by her/his email address)

  • Organization (org_id) = organization of the caller

  • Origin (if this field exists on the ticket) = 'mail'

Default (i.e. constant) values must be supplied, via the “Ticket Default Values” setting, for any other mandatory field of the Ticket, otherwise the creation of the Ticket will fail.

When updating an existing Ticket, the application add an entry into the public_log field (configurable, see below), with the “new part” of the message. See below for more explanation about how the “new part” is extracted from the message.

Specifying default values

The syntax for specifying default values is the following:

  • One field per line, with the syntax:

  • field_code:default_value

If the field to initialize is a key to another object (for the fields like org_id, service_id, etc…) you can specify either the numeric identifier of the target object (e.g.service_id:153) or its name (e.g. org_id:Demo), provided that the name is unique.

The default values are applied after the standard data mapping described above. Therefore it is possible to override the default data mapping with some constant values.

If the incoming email has no subject, you can specify the default title to be set for the Ticket via the field “Default Title (if subject is empty)”. This is different from the default values listed above, since this value will be used only if the email has no subject. If the “Default Title (if subject is empty)” the system will supply a default value (“No Subject”) since the title is mandatory to create the Ticket.

Configuration

The behavior for each mailbox (which messages to process and whether to create or update a Ticket) is managed via the menu “Incoming eMail Inboxes” in the “Admin tools” section:

https://www.itophub.io/wiki/media?media=extensions%3Aemail-synchro-menu.png

Click, “Create a new Mail Inbox” to create a new configuration for a mail inbox. This displays the following form:

New mail inbox

Mailbox Configuration

The “Mailbox configuration” defines how the application connects to the mail inbox:

FieldMeaningSample Value
Mail ServerThe IP address or fully qualified hostname of the mail server10.153.20.142 or pop3.mycompany.com
LoginThe name of the mail account used for connecting to the mailboxtest@mycompany.com
PasswordThe password for the above mentioned account 
ProtocolThe protocol to connect to the mail server: either POP3 or IMAP.
If you need to use IMAP with SSL or TLS, refer to the imap_options configuration parameter below.
POP3
PortThe TCP port to connect to the server. The standard values are 110 (secured: 995) for POP3 and 143 (secured: 993) for IMAP110
Mailbox (for IMAP)The IMAP mailbox (folder) to scan for incoming messages. If omitted the default (root) mailbox will be scanned. This option is ignored when using the POP3 protocol.INBOX.Folder.Subfolder
ActiveIf set to “Yes”, the inbox will be polled. Otherwise no.Yes
Debug traceUse this setting for tracing all the background operations related to this inbox for debugging and troubleshooting purposes. It is not recommended to activate this option for long periods on production since it tends to generate a lot of output which slows down the serverNo

Emails in Error

This section defines the behavior when an incoming email cannot be processed properly. The email can be either kept in the mailbox (and remembered as an “Error” and no longer processed) or deleted immediately from the mailbox. Furthermore the original message can be forwarded to an administrator (as an attachment) along with some explanation about the cause of the error.

FieldMeaningSample Value
BehaviorWhether or not the emails processed with an error should be kept in the mailbox. If so, the message will be flagged as “Error” and no longer processed, but still available for reading from the mailbox.Keep the message in the mailbox
Forward eMails toThe email address to which to forward the email when an error occurs. The forwarded message contains some explanation about the error and the original email as an attachment. If this address is left empty, the incoming emails which cannot be processed will simply be deleted from the inbox without further notice.itopadmin@mycompany.com
(From)The IP address to be used as the “sender” of the error notification. For security reasons, many mail servers do not relay messages if the sender address is not a known address.itopadmin@mycompany.com

Behavior on Incoming eMails

This section defines the behavior of the application when processing incoming emails.

FieldMeaningSample Value
BehaviorThe behavior when a new message arrives in the inbox. The possible values are:
Create or Update: create a new Ticket or Update an existing one if a matching Ticket is found
Create new ticket: each new message creates a new Ticket
Update existing tickets: all incoming messages which do not match an existing Ticket are treated as errors.
Create or Update
After processing the eMailThe action to be taken after successfully processing an incoming eMail: either keep the eMail on the mail server (until the associated ticket is closed or deleted) or delete the eMail immediately.Keep the eMail on the mail server
Ticket ClassThe class of Tickets to create or update when receiving an email. Make sure that you select a valid class for your iTop configuration.User Request
Ticket default ValuesThe syntax for “Ticket Default Values” and “New Person's Default Values” are:
- one field to initialize per line
- <field_code>:<constant_value>
service_id:Networking
Default Title (if subject is empty)The value to be used as the title of the Ticket, if the subject of the incoming email is empty. If this field is left empty the system will supply a default value (“No Subject”)Empty subject
Title patternEach notification sent by the application contains a reference to the “source” Ticket in the MessageID field of the email. Email client applications generally store this identifier in the “in-reply-to” or “references” header of the reply email. This is the primary mean of identifying that an email message is related to a ticket. If this header is not present in the incoming message, the application can parse the “subject” field to look for a given match. This pattern determines how to parse the subject. The pattern specified here must follow the PCRE syntax./R-([0-9]{6})/
Stimuli to applyA list of state_code:stimulus_code (one per line) to define the stimulus to apply (after updating a ticket), for the given state of the ticket. This is useful for example to automatically reassign a ticket which is in the state “pending”.pending:ev_assign

Unknown Callers

This section determines the behavior of the application when the sender of an email (Fromemoticon_smile does not correspond to a known email address in the application. There are two possibilites:

  • Reject the eMail: the incoming email is treated as an error and thus either forwarded to an administrator or deleted.

  • Create a new person: a new Person will be created based on the email of the sender and constant values defined below.

FieldMeaningSample Value
Behavior in case of Unknown CallerWhat to do when the sender of the incoming email message does not correspond to any Person recorded in the applicationCreate a new person
Unknown Caller rejection replyOptional reply to sender when the unknown caller behavior is set to “Reject the eMail” (no message is sent when left empty)empty
New Person's Default ValuesDefault values for initializing the new Person. The application automatically fills the email field with the email address of the sender of the message. All other mandatory fields must be initialized with constant values provided here, otherwise the creation of the new Person will fail.first_name:Unknown
name:Caller
org_id:Demo

Behavior for Additional Contacts

This section determines the behavior of the application regarding the additional recipients of the incoming email (persons in To: and CC: of the message). It is possible to specify if/when the email addresses which correspond to a valid contact in iTop are added to the ticket (via the Contacts tab). Email addresses which do not correspond to a valid contact in iTop are always ignored.

FieldMeaningSample Value
Add more contacts (To, CC)Whether or not to add the To: and CC: email addresses as additional contacts to the ticket. The possible values are:
* Never: no additional contact will be added
* Always: additional contacts will be added when creating and updating a ticket
* When creating a ticket: additional contacts will be added only when creating a new ticket
* When updating a ticket: additional contacts will be added only when updating an existing ticket
Never

Other configuration parameters

In addition to the configuration performed by creating a Mail Inbox object using the user interface of the application, a few parameters are available in the configuration file to fine tune the behavior of the application.

The parameters listed below apply to all the Mail Inboxes

The recommended value for the configuration parameter body_parts_order istext/html,text/plain. Indeed in order to properly import the images embedded inside an HTMLemail, the HTML version of the email must be processed instead of the plain text version.

   'combodo-email-synchro' =>  (
      'debug' => false,
      'periodicity' => 30,
      'body_parts_order' => 'text/html,text/plain',
      'pop3_auth_option' => 'USER',
      'imap_options' =>  (
            0 => 'imap',
      ),
      'exclude_attachment_types' =>  (
            0 => 'application/exe',
      ),
      'maximum_email_size' => '10M',
      'recommended_max_allowed_packet' => 10485760,
      'introductory-patterns' =>  (
            0 => '/^le .+ a écrit :$/i',
            1 => '/^on .+ wrote:$/i',
            2 => '|^[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} .+:$|',
      ),
      'multiline-delimiter-patterns' =>  (
            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',
      ),
      'delimiter-patterns' =>  (
            '/^>.*$/' => false,  // "false" remove only the line, "true" remove the rest of the message
      ),
      'big_files_dir' => '',
      'use_message_id_as_uid' => false, // Don't change this unless you know what you are doing!
      'images_minimum_size' => '100x20',
      'images_maximum_size' => '',
      'undesired-subject-patterns' =>  (
            0 => '/^Out Of Office/i',
            1 => '/^Automatic answer$/i',
            2 => '/^Réponse automatique:/',
      ),
      'undesired-purge-delay' => 7,
      'html-tags-to-remove' => (
           'blockquote' => (), 
           // No class specified, remove any blockquote tag
           'div' => ('gmail_quote', 'moz-cite-prefix'),
           'pre' => ('moz-signature'),
      );
 
   ),
ParameterMeaningDefault Value
debugSet to true to turn on debug outputfalse
periodicityInterval (in seconds) at which to check for incoming messages30
body_parts_orderComma separated, ordered, list of MIME types, determining the preferred part of the message to retrieve for populating the description or public_log of the Ticket. In order to import as inline images the images embedded in HTML, the HTML part of the email must be processed in priority over the text part. Therefore the recommended configuration istext/html,text/plain.text/html,text/plain
pop3_auth_optionsPOP3 authentication options. Possible values are: 'CRAM-MD5', 'APOP' , 'PLAIN' , 'LOGIN', 'USER'USER
imap_optionsAdditional IMAP options. Possible values are listed here: IMAP flags.
For example to use SSL you could specify : array(0 ⇒ 'imap', 2 ⇒ 'ssl')
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')
exclude_attachment_typesArray of MIME types to exclude when retrieving attachmentsarray('application/attachment')
html-tags-to-removenew 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 => array of CSS class names.see above
maximum_email_sizeIf 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-patternsonly 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 PCRE syntax.see above
multiline-delimiter-patternsonly for plain text emails and only for mail for ticket update 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… Patterns must follow the PCRE syntax.see above
delimiter-patternsonly for plain text emails and only for mail for ticket update this regular expression patterns are used for detecting the lines beginning “old part” of a message, in case none of the multiline-delimiter-patterns did match. Patterns must follow the PCRE syntax.see above
big_files_dirThe 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_uidBoolean. 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
images_minimum_sizeMinimum dimensions for importing images. Images smaller than the given dimensions will be ignored and not imported as attachments. The dimensions are expressed as a stringwidthxheight (where width and height are integer numbers, in pixels).100×20
images_maximum_sizeImages bigger than these dimensions (for example 1000×1000) will be resized to fit in the given dimensions. The dimensions are expressed as a string widthxheight (where width and height are integer numbers, in pixels). Note this feature is available only if PHP GD is installed. If no dimensions are given, the images are never resized. 
undesired-subject-patternsAn 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 PCRE syntax.array()
undesired-purge-delayDelay in days to remove automatically the undesired messages (0 means that the messages are removed immediately)7
recommended_max_allowed_packetDisplay a warning on the 'Mailbox Content' screen if the database parameter 'max_allowed_packet' is less than the one configured10*1024*1024

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.

        'itop-standard-email-synchro' =>  (
                'ticket_log' =>  (
                          'UserRequest' => 'public_log',
                          'Incident' => 'public_log',
                        ),
        ),
ParameterMeaningDefault Value
ticket_logAn 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

Troubleshooting

Limitations

  • Each mail inbox configured corresponds to one type of Ticket (i.e. User Requests or Incidents, but not both).

  • Connecting to a POP3 mailbox via the php IMAP extension does not work. You must use the POP3 configuration via PEAR::NetSocket for such a case.

  • There is no validation that the target class of the Mail Inbox is an existing class in iTop. (i.e. don't try to create incidents if the Incident Management module is not installed).

  • The support of inline images works only if the preferred order for email parts is configured as “text/html,text/plain” (i.e. HTML first), which is now the default for all new installations.

When processing an email considered as an update to a ticket, the extensions tries to extract the “new part” of the message (excluding the content from previous messages). However, depending on the format of the reply (which itself depends on the email client software used) it may not be possible to extract this information in a reliable manner. In such a case the whole text of the email will be used. Unfortunately, the widely used MS Outlook is an example of such client software where the replies cannot reliably be identified. Refer to the configuration parameter html-tags-to-remove for explanations about how to adjust this behavior.

Checking the connection

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.

Mailbox Content tab

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.

This view also allows to perform two different kind of actions on a set of messages:

  • “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 !!

  • “Ignore eMail”: mark new messages as “ignored” to avoid processing them.

Debugging

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.

Since the processing of the incoming emails occurs in the background, it is not always easy to understand what happens when a ticket is not processed as expected. In order to trace the execution of this background task, several levels of tracing are available:

  • by setting the “Debug trace” field to “Yes”, more trace will be generated when processing the mailbox. This trace goes to the output of the cron job, and is also captured (limited to 256 KB) in the database. This captured trace is visible in the “Debug Trace” tab of the Mail Inbox object.

  • the configuration setting debug for the module combodo-email-synchro can be set to true in the configuration file. This activates even more traces for all the configured mail inboxes. This additional trace appears only in the output of the cron job.

  • the cron job can be passed the optional parameter --verbose=1 to activate some debug trace for all the background tasks. This additional trace also goes into the output of the cron job.

If the cron job is not already running in the background it is convenient to run it manually from the command line, to see what's happening:

php cron.php --auth_user=<user> --auth_pwd=<pwd> --verbose=1

Debug trace tab

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.

Questions & Answers

Question: Mails are no more processed?
Answer:

  1. 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 Ignorebutton.

  2. To limit the above situation, check coherence between allowed_max_packet, recommended_max_allowed_packet and maximum_email_size parameters.

  3. 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.),…

 

标签:
由 superadmin 在 2020/08/27, 16:09 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司