span8
span4
span8
span4
这篇文章是在2018.1审查,但适用于FME服务器2016以上。对于FME服务器版本的2015年这篇文章的,请参见: 接收电子邮件,第2部分:处理与工作空间的电子邮件 (2015)
This tutorial is part of the series电子邮件在FME Server中。
Previous section:接收电子邮件,第1部分
Next section:接收电子邮件,第3部分
This article is the second in a three-part tutorial series on receiving emails in FME Server.This section will cover how we can use a workspace published to FME Server via the Notification Service to process and log the details from the incoming email by subscribing to the Topic we created in接收电子邮件,第1部分.
FME Server and FME Desktop installed
Completion of接收电子邮件,第1部分
We will set up FME Server to trigger a workspace to run in response to incoming messages to the RECEIVE_EMAIL topic.There are two workspace templates provided in the Downloads section of this article, respective of whether you set up an SMTP or IMAP Email Publication in the previous tutorial.
The workspace is designed to log all the information from the email as attributes so they can be viewed in the job log through the FME Server web interface.
You can either download the attached workspace template or create this .fmw file yourself using the following instructions.
In order to be able to run this workspace using the notification service, we first need to publish it up to FME Server.When publishing the workspace, we have to set the topic to which it will be subscribed and specify which reader will receive the JSON file.
Go to File > Publish to FME Server.Connect to your server, and under the Register Services window check the Notification Service.
发布工作区,它注册到通知服务
If you were to receive a new email now you should see this workspace listed under the Completed Jobs tab in the FME Server Web Interface.
To test if you have successfully set up the Subscription via registration to the Notification Service, simply send an email to the account you configured in the previous section of this tutorial series.As a reminder for SMTP this will by myusername@myserver.mydomain and for IMAP this is your own external mail account.This should cause the workspace to run, to confirm this you review Job History under Jobs > Completed.
乔布斯触发通过在已完成作业页的通知服务列表
Click on the Workspace Name to view the log.Review the log to find the list of attributes stored by the logger, including email subject, content, from and to address.
例如日志文件
如果您需要基于电子邮件的主题,以采取不同的行动 - 也许你正在接受不同的项目文件 - 您可以过滤和路由邮件到不同的子工作区。这种技术效果很好,如果你设置了基于正则表达式,过滤主题前面部分。
如果您想了解更多有关此选项,请在本教程演示如何使用TestFilter路由与电子邮件主题行中的三个潜在不同的项目名称(FilterBySubject.fmwt)提供的其他样本的工作空间。
使用“包含”操作基于发布者过滤器,以测试电子邮件主题
要正确设置它,你也将返回到FME Server的IMAP电子邮件发布和过滤器类型设置为正则表达式,然后将过滤主题设置为:
project105 | project481 | project772
IMAP出版filter类型设置为正则表达式
测试是否过滤已正确设置,我们将发送电子邮件主题“project105”的电子邮件。
Open the FilterBySubject.fmw and enable the FMEServerJobSubmitter for project105.
In the Parameter Editor select your FME Server connection.For the Repository select Samples and select the austinApartments.fmw.
Repeat the steps used above to publish the Workspace to FME Server under the Notification Service.Select RECEIVE_EMAIL as the Subscription Topic.
Send an email with the Subject project105
Return to the FME Server Web UI and go to the Completed Job History page to check both the FilterbySubject.fmw and the austinApartments.fmw workspace was run.
电子邮件佤邦tch topic triggers FilterbySubject.fmw
如果您发送另一封电子邮件,其中的对象不含“project105”那么这将不是一个主题消息传递所以没有工作空间将被运行。
在教程的这一部分,我们创建并公布了处理邮件工作空间。它只是记录该电子邮件的主题行,但在本教程的下一部分,我们将扩大它来处理电子邮件附件。
如果你的新配置的通知设置不能按预期工作,你可以使用FME Server的日志文件,以帮助缩小问题。下面出了示意图邮件如何流过每个FME Server组件和日志文件在每个点进行更新。检查这些信息和时间戳这些文件以确认电子邮件到达每个组件。
Flow chart of receiving email process with associated log files
对于SMTP以下属性可以以提取从传入的电子邮件JSON的详细信息进行曝光:
email_publisher_attachment {} email_publisher_content_type {} email_publisher_content {} email_publisher_from email_publisher_to email_publisher_received email_publisher_sent email_publisher_subject fns_topic fns_type
为IMAP以下属性可以以提取从传入的电子邮件JSON的详细信息进行曝光:
imap_publisher_attachment {} imap_publisher_content {} imap_publisher_sent imap_publisher_from imap_publisher_subject imap_publisher_content_type {} imap_publisher_received imap_publisher_to fns_type
注:“_publisher_received”属性不FME日期/时间格式进行格式化。包括在下载部分上面是一个包含如何将其转换为标准格式的实例的工作空间。这应该使这些信息更容易使用与其他变压器。
© 2020 Safe Software Inc |Legal