阅读Mule ESB中的传入IMAP电子邮件标题

时间:2016-08-11 12:44:20

标签: email header mule esb

我们公司目前正在与IBM合作,将Mule配置为监控电子邮件NDR的邮箱,然后根据电子邮件标题处理中的Keyword:处理退回的电子邮件。

我对Mule几乎一无所知,看起来IBM的同事们并不聪明。我可以看到入站NDR有一个名为Keywords:的标题行,但Mule日志没有显示它的迹象。已启用日志记录以输出Keywords:,但显示为null

我假设它需要在某处配置,因为所有常见的标题都显示正常:

contentType=multipart/report; report-type=delivery-status;
fromAddress=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36a@XXXXXXXXXX.onmicrosoft.com>
replyToAddresses=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36a@XXXXXXXXXX.onmicrosoft.com>
sentDate=Thu Aug 11 12:04:30 BST 2016
subject=Undeliverable: About Number: 7000102920
toAddresses=BounceBack.Test@XXXXXXXXXX.com

我撞到了一堵砖墙并继续绕圈,所以我希望有人可以指出我需要完成相关配置的地方,所以我可以通知所谓的&#34 ;专家&#34;

补充说明了对brazo的评论。我必须改变一些变量来使它们去个性化,但其他一切都完好无损。我真的不知道这些东西,只是把它从ESB服务器上的一个文件中捞出来。

我被告知输出#[message]应该显示所有标题,但遗憾的是Keywords没有被写入。我已经仔细检查了Outlook中的电子邮件标题,它肯定存在。

<imaps:inbound-endpoint responseTimeout="10000" doc:name="MailErrorMailBox" user="${esb.documentgenerationemaildeliveryfailure.mailbox.user}" password="${esb.documentgenerationemaildeliveryfailure.mailbox.password}" host="${esb.documentgenerationemaildeliveryfailure.mailbox.host}" port="${esb.documentgenerationemaildeliveryfailure.mailbox.port}" 
        connector-ref="imapsConnector" transformer-refs="returnAttachments" doc:description="Inbound for MailErrorMailBox" />
<logger level="DEBUG" />
<logger message="${msgId} #[flowVars['TransactID']] |#[flow.name]| Message from the email Service #[message]" level="INFO" doc:name="Logger" />

<logger message="${msgId} #[flowVars['TransactID']] |#[flow.name]| Contents retrieved from mail....batchName..#[message.inboundProperties['batchName']].....
        requestingSystem....#[message.inboundProperties['Return-Path']]...smtpAction...#[message.inboundProperties['smtpAction']]...smtpStatus..#[message.inboundProperties['smtpStatus']]...
        smtpDSNDeliveryStatus...#[message.inboundProperties['SMTPDSNDeliveryStatus']]....smtpDSNDeliveryReason...#[message.inboundProperties['SMTPDSNDeliveryReason']]"
        level="INFO" doc:name="Logger" />
<logger message="Message inbound Properties for keywords:: #[message.inboundProperties['Keywords:']] or the other one #[message.inboundProperties['Keywords']]" level="INFO" doc:name="Logger" />   
<logger message="${msgId} #[flowVars['TransactID']] |#[flow.name]| Contents retrieved from mail...
        Subject::#[message.inboundProperties['Subject']]...Keywords::#[message.inboundProperties['Keywords:']].. 
        Keywords:BatchName::#[message.inboundProperties['Keywords: batchName']]..Keywords: requestingSystem::#[message.inboundProperties['Keywords: requestingSystem']]"
        level="INFO" doc:name="Logger" />
<logger message="inbound Properties for keywords:: #[inboundProperties['Keywords']]...#[inboundProperties['Keywords:']]" level="INFO" doc:name="Logger" />  

<flow-ref name="EmailDeliveryStatusUpdateHndSubFlow" doc:name="EmailDeliveryStatusUpdateHndSubFlow Reference"
        doc:description="Refers to the flow where tranforms delivery status 
        messages retrieved from mail box, transforms into UpdateRequestMessage and puts this message into UpdateQueue" />

<exception-strategy ref="CommonExceptionStrategy" doc:name="EmailDeliveryStatusUpdateExceptionStrategy"
        doc:description="Exception strategy is used to handle exceptions in EmailDeliveryStatusUpdateHnd flow" />

日志输出:

    Message from the email Service 
org.mule.DefaultMuleMessage
{
  id=631f9e20-5fb3-11e6-98ed-0050568411c3
  payload=java.util.Collections$UnmodifiableRandomAccessList
  correlationId=<not set>
  correlationGroup=-1
  correlationSeq=-1
  encoding=UTF-8
  exceptionPayload=<not set>

Message properties:
  INVOCATION scoped properties:
    startTimestamps={1-63236eb2-5fb3-11e6-98ed-0050568411c3:flowlike:MailErrorMailBoxFlow#[DocumentGenerationEmailDeliveryFailure-1.0.12-4677].imapsConnector.receiver.01=1470913474844}
  INBOUND scoped properties:
    0Headers={Content-Type=multipart/alternative; differences=Content-Type;
    boundary="5720b157-6ac6-4d83-966a-33ad74171d62", X-Microsoft-Exchange-Diagnostics=1;mailserver;9:cRRFeUAdYPRBiyTYpDTA5lQmVHBi1g/3iHOMtv6E8r0qbhKk7fk8HBM1xD7GbVZw+272bkKy6e8tvBhc1NkPLv4M8tuLo382CeCUdS+Ordq2qzHRnLTIRHe9WwX7PE+4g9M1PBhy25AzNn3YwpaCzJgVUHAza1jivZBbvNGwnbRggI0Lsb/uOS5MtBDU9GtfSO3v7pe02sQz9HHQuh7iSw==}
    1Headers={Content-Type=message/delivery-status, X-Microsoft-Exchange-Diagnostics=1;mailserver;9:cRRFeUAdYPRBiyTYpDTA5lQmVHBi1g/3iHOMtv6E8r0qbhKk7fk8HBM1xD7GbVZw+272bkKy6e8tvBhc1NkPLv4M8tuLo382CeCUdS+Ordq2qzHRnLTIRHe9WwX7PE+4g9M1PBhy25AzNn3YwpaCzJgVUHAza1jivZBbvNGwnbRggI0Lsb/uOS5MtBDU9GtfSO3v7pe02sQz9HHQuh7iSw==}
    2Headers={Content-Type=message/rfc822, X-Microsoft-Exchange-Diagnostics=1;mailserver;9:cRRFeUAdYPRBiyTYpDTA5lQmVHBi1g/3iHOMtv6E8r0qbhKk7fk8HBM1xD7GbVZw+272bkKy6e8tvBhc1NkPLv4M8tuLo382CeCUdS+Ordq2qzHRnLTIRHe9WwX7PE+4g9M1PBhy25AzNn3YwpaCzJgVUHAza1jivZBbvNGwnbRggI0Lsb/uOS5MtBDU9GtfSO3v7pe02sQz9HHQuh7iSw==}
    Authentication-Results=XXXXXXXXXX.co.uk; dkim=none (message not signed)
 header.d=none;XXXXXXXXXX.co.uk; dmarc=none action=none
 header.from=XXXXXXXXXX.onmicrosoft.com;
    Auto-Submitted=auto-replied
    Content-Language=en-US
    Content-Type=multipart/report; report-type=delivery-status;
    boundary="22cf7e76-a186-4578-a350-dcf882b78a2c"
    Date=Thu, 11 Aug 2016 11:04:30 +0000
    From=Microsoft Outlook
    <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@XXXXXXXXXX.onmicrosoft.com>
    In-Reply-To=<260310942.53.1470913447307.JavaMail.user@server>
    List:Authentication-Results=[XXXXXXXXXX.co.uk; dkim=none (message not signed)
 header.d=none;XXXXXXXXXX.co.uk; dmarc=none action=none
 header.from=XXXXXXXXXX.onmicrosoft.com;]
    List:Auto-Submitted=[auto-replied]
    List:Content-Language=[en-US]
    List:Content-Type=[multipart/report; report-type=delivery-status;
    boundary="22cf7e76-a186-4578-a350-dcf882b78a2c"]
    List:Date=[Thu, 11 Aug 2016 11:04:30 +0000]
    List:From=[Microsoft Outlook
    <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@XXXXXXXXXX.onmicrosoft.com>]
    List:In-Reply-To=[<260310942.53.1470913447307.JavaMail.user@server>]
    List:MIME-Version=[1.0]
    List:Message-ID=[<676ceca7-b6fd-46be-9e89-952a3953428f@mailserver.prd.prod.outlook.com>]
    List:Received=[from mailserver.prd.prod.outlook.com (10.XXX.XXX.136) by
 mailserver.prd.prod.outlook.com (10.XXX.XXX.136) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.549.15 via Mailbox Transport; Thu, 11 Aug 2016 11:04:31 +0000, from mailserver.prd.prod.outlook.com (10.XXX.XXX.147) by
 mailserver.prd.prod.outlook.com (10.XXX.XXX.136) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.549.15; Thu, 11 Aug 2016 11:04:30 +0000]
    List:References=[<260310942.53.1470913447307.JavaMail.user@server>]
    List:Return-Path=[<>]
    List:SpamDiagnosticOutput=[1:0]
    List:Subject=[Undeliverable: About Number: 7000102920]
    List:To=[<BounceBack.Test@XXXXXXXXXX.co.uk>]

    MIME-Version=1.0
    MULE_ORIGINATING_ENDPOINT=endpoint.imaps.AB.CD.999999.XXXXXXXXXX.co.uk
    Message-ID=<676ceca7-b6fd-46be-9e89-952a3953428f@mailserver.prd.prod.outlook.com>
    Received=from mailserver.prd.prod.outlook.com (10.XXX.XXX.136) by
 mailserver.prd.prod.outlook.com (10.XXX.XXX.136) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.549.15 via Mailbox Transport; Thu, 11 Aug 2016 11:04:31 +0000
    References=<260310942.53.1470913447307.JavaMail.user@server>
    Return-Path=<>
    SpamDiagnosticOutput=1:0
    To=<BounceBack.Test@XXXXXXXXXX.co.uk>

    bccAddresses=
    ccAddresses=
    contentType=multipart/report; report-type=delivery-status;
    boundary="22cf7e76-a186-4578-a350-dcf882b78a2c"
    fromAddress=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@XXXXXXXXXX.onmicrosoft.com>
    replyToAddresses=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@XXXXXXXXXX.onmicrosoft.com>
    sentDate=Thu Aug 11 12:04:30 BST 2016
    subject=Undeliverable: About Number: 7000102920
    toAddresses=BounceBack.Test@XXXXXXXXXX.co.uk
  OUTBOUND scoped properties:
    APPDYNAMICS_GUID=71d444d0-a663-4dba-8bf6-0469ff1d069f
    MULE_ENCODING=UTF-8
  SESSION scoped properties:
}

在Outlook中看到的标题(注意,日志输出和下面的标题详细信息与日志文件丢失的电子邮件不同,但它们是我一直在做的相同的测试,因此我可以保证每次都有Keywords标题条目:

Received: from mailserver.prd.prod.outlook.com (10.XXX.XXX.179) by
HE1PR03MB1481.prd.prod.outlook.com (10.XXX.XXX.151) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
15.1.549.15; Tue, 9 Aug 2016 10:37:42 +0000
Received: from XXX.protection.gbl (2a01:111:f400:7e04::142) by
mailserver.outlook.office365.com (2a01:111:e400:8040::51) with Microsoft
SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384)
id 15.1.549.15 via Frontend Transport; Tue, 9 Aug 2016 10:37:42 +0000
Authentication-Results: spf=fail (sender IP is 195.171.18.234)
smtp.mailfrom=XXXXXXXXXX.co.uk; XXXXXXXXXX.mail.onmicrosoft.com;
dkim=none (message not signed)
header.d=none;XXXXXXXXXX.mail.onmicrosoft.com; dmarc=none action=none
header.from=;
Received-SPF: Fail (protection.outlook.com: domain of XXXXXXXXXX.co.uk
does not designate 195.171.18.234 as permitted sender)
receiver=protection.outlook.com; client-ip=195.171.18.234;
helo=edge.XXXXXXXXXX.co.uk;
Received: from edge.XXXXXXXXXX.co.uk (195.171.18.234) by
XXX.mail.protection.outlook.com (10.47.217.78) with Microsoft SMTP
Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id
15.1.557.8 via Frontend Transport; Tue, 9 Aug 2016 10:37:43 +0000
Received: from server.gwd.grpinf.net (172.23.226.210) by
edge.XXXXXXXXXX.co.uk (172.23.245.41) with Microsoft SMTP Server (TLS)
id 14.3.210.2; Tue, 9 Aug 2016 11:37:33 +0100
Received: from uk-mgdirn-ap002.gwd.grpinf.net (172.23.245.28) by
server.gwd.grpinf.net (172.23.226.213) with Microsoft SMTP Server id
14.3.210.2; Tue, 9 Aug 2016 11:37:33 +0100
Received: from unknown (HELO dcn2dwal913) ([172.23.245.28])  by
uk-mgdirn-ap002.gwd.grpinf.net with ESMTP; 09 Aug 2016 11:37:34 +0100
Date: Tue, 9 Aug 2016 11:37:33 +0100
From: "[UAT] Test" <NO_REPLY>
To: revised NB <b4cbouncebacktest@XXXXXXXXXX.co.uk>
Message-ID: <1592434427.5.1470739053332.JavaMail.user@server>
Subject: About Number: 7000102920
Keywords: batchName=0567f0a36407435e98ca545c1349c0ce;requestingSystem=ABCD
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_Part_4_958412679.1470739053301"
Return-Path: BounceBack.Test@XXXXXXXXXX.co.uk

根据brazo的评论,我们有这样的流程:

    <flow processingStrategy="synchronous" name="MailErrorMailBoxFlow" doc:name="MailErrorMailBoxFlow" doc:description="This flow reads the mails from MailErrorMailBox 
and puts the delivery status message into UpdateReqQ">

<imaps:inbound-endpoint responseTimeout="10000" doc:name="MailErrorMailBox" user="${esb.documentgenerationemaildeliveryfailure.mailbox.user}" password="${esb.documentgenerationemaildeliveryfailure.mailbox.password}" host="${esb.documentgenerationemaildeliveryfailure.mailbox.host}" port="${esb.documentgenerationemaildeliveryfailure.mailbox.port}" 
connector-ref="imapsConnector" disableTransportTransformer="true" doc:description="Inbound for MailErrorMailBox" />

<logger message="Received Payload: #[payload]" level="INFO" doc:name="Logger"/>
<logger message="Received Message: #[message]" level="INFO" doc:name="Logger" />
<logger level="DEBUG" message="Payload as String: #[message.payloadAs(java.lang.String)]"/>
<logger level="DEBUG" message="Data Type of Payload: #[message.getDataType]"/>

etc...

这会产生(我已经删除了所有的Exchange内容,因为它使它超过了正文字符数):

18-Aug-2016 13:10:40.479 INFO  DocumentGenerationEmailDeliveryFailure [DocumentGenerationEmailDeliveryFailure-1.0.15-4728].imapsConnector.receiver.02 processor.LoggerMessageProcessor correlationID: appDynamicHttpHeader: - Received Payload: javax.mail.internet.MimeMessage@908e18b
18-Aug-2016 13:10:40.483 INFO  DocumentGenerationEmailDeliveryFailure [DocumentGenerationEmailDeliveryFailure-1.0.15-4728].imapsConnector.receiver.02 processor.LoggerMessageProcessor correlationID: appDynamicHttpHeader: - Received Message: 
org.mule.DefaultMuleMessage
{
  id=c7ac74b0-653c-11e6-8b87-0050568411c3
  payload=javax.mail.internet.MimeMessage
  correlationId=<not set>
  correlationGroup=-1
  correlationSeq=-1
  encoding=UTF-8
  exceptionPayload=<not set>

Message properties:
  INVOCATION scoped properties:
    startTimestamps={1-c7b8a9b1-653c-11e6-8b87-0050568411c3:flowlike:DLGMailErrorMailBoxFlow#[DocumentGenerationEmailDeliveryFailure-1.0.15-4728].imapsConnector.receiver.02=1471522240476}
  INBOUND scoped properties:
    0Headers={Content-Type=multipart/alternative; differences=Content-Type;
    boundary="28acc557-a764-4ecf-9e77-16fa5f92c79b", 

    Authentication-Results=grp.co.uk; dkim=none (message not signed)
 header.d=none;grp.co.uk; dmarc=none action=none
 header.from=grp.onmicrosoft.com;
    Auto-Submitted=auto-replied
    Content-Language=en-US
    Content-Type=multipart/report; report-type=delivery-status;
    boundary="c0871f9c-2c75-4842-8a17-8308e6a9b326"
    Date=Thu, 18 Aug 2016 12:10:33 +0000
    From=Microsoft Outlook
    <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@grp.onmicrosoft.com>
    In-Reply-To=<658849591.157.1471522231052.JavaMail.head@server>
    List:Authentication-Results=[grp.co.uk; dkim=none (message not signed)
 header.d=none;grp.co.uk; dmarc=none action=none
 header.from=grp.onmicrosoft.com;]
    List:Auto-Submitted=[auto-replied]
    List:Content-Language=[en-US]
    List:Content-Type=[multipart/report; report-type=delivery-status;
    boundary="c0871f9c-2c75-4842-8a17-8308e6a9b326"]
    List:Date=[Thu, 18 Aug 2016 12:10:33 +0000]
    List:From=[Microsoft Outlook
    <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@grp.onmicrosoft.com>]
    List:In-Reply-To=[<658849591.157.1471522231052.JavaMail.head@server>]
    List:MIME-Version=[1.0]
    List:Message-ID=[<8ee0fb04-84c2-4355-8aba-8e85cbd608ac@XXX.prod.outlook.com>]
    List:Received=[from XXX.prod.outlook.com (10.XXX.XXX.137) by
 XXX.prod.outlook.com (10.XXX.XXX.136) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.549.15 via Mailbox Transport; Thu, 18 Aug 2016 12:10:33 +0000, from XXX.prod.outlook.com (10.XXX.XXX.150) by
 XXX.prod.outlook.com (10.XXX.XXX.137) with Microsoft SMTP
 Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id
 15.1.549.15; Thu, 18 Aug 2016 12:10:33 +0000]
    List:References=[<658849591.157.1471522231052.JavaMail.head@server>]
    List:Return-Path=[<>]
    List:SpamDiagnosticOutput=[1:0]
    List:Subject=[Undeliverable: About Number: 5000102334]
    List:To=[<ST3@grp.co.uk>]

    MIME-Version=1.0
    MULE_ORIGINATING_ENDPOINT=endpoint.imaps.SM.FM.999171.grp.co.uk
    Message-ID=<8ee0fb04-84c2-4355-8aba-8e85cbd608ac@XXX.prod.outlook.com>
    Received=from XXX.prod.outlook.com (10.XXX.XXX.137) by
XXX.prod.outlook.com (10.XXX.XXX.136) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id
 15.1.549.15 via Mailbox Transport; Thu, 18 Aug 2016 12:10:33 +0000
    References=<658849591.157.1471522231052.JavaMail.head@server>
    Return-Path=<>
    SpamDiagnosticOutput=1:0
    To=<ST3@grp.co.uk>

    bccAddresses=
    ccAddresses=
    contentType=multipart/report; report-type=delivery-status;
    boundary="c0871f9c-2c75-4842-8a17-8308e6a9b326"
    fromAddress=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@grp.onmicrosoft.com>
    replyToAddresses=Microsoft Outlook <MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@grp.onmicrosoft.com>
    sentDate=Thu Aug 18 13:10:33 BST 2016
    subject=Undeliverable: About Number: 5000102334
    toAddresses=ST3@grp.co.uk
  OUTBOUND scoped properties:
    APPDYNAMICS_GUID=68df660c-b5b3-4803-bd73-acbcb5a0fd42
    MULE_ENCODING=UTF-8
  SESSION scoped properties:
}
18-Aug-2016 13:10:40.488 DEBUG DocumentGenerationEmailDeliveryFailure [DocumentGenerationEmailDeliveryFailure-1.0.15-4728].imapsConnector.receiver.02 processor.LoggerMessageProcessor correlationID: appDynamicHttpHeader: - Payload as String: javax.mail.internet.MimeMessage@908e18b
18-Aug-2016 13:10:40.492 DEBUG DocumentGenerationEmailDeliveryFailure [DocumentGenerationEmailDeliveryFailure-1.0.15-4728].imapsConnector.receiver.02 processor.LoggerMessageProcessor correlationID: appDynamicHttpHeader: - Data Type of Payload: null

0 个答案:

没有答案