You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WSO2 EI 6.6.0使用mailto发邮件报无法推断传输信息错误排查

WSO2 EI 6.6.0 mailto传输报错修复方案

问题现象

在WSO2 EI 6.6.0环境中使用mailto功能发送携带错误信息的通知邮件,调用对应API时抛出报错:
The system cannot infer the transport information from the mailto error

原错误处理序列(ErrorSeq)代码

<sequence name="ErrorSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="$ctx:token//*[local-name()='errorEmailRecipients']" name="errorEmailRecipients" scope="default" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<property name="Subject" scope="transport" type="STRING" value="Error While Processing Records"/>
<header expression="concat('mailto:', $ctx:errorEmailRecipients)" name="To" scope="default"/>
<payloadFactory media-type="xml">
    <format>
        <root>
            <html>
                <body>
                    <p>There was an error While Processing Audio Record</p>
                    <p>Error Details: $1</p>
                </body>
            </html>
        </root>
    </format>
    <args>
        <arg evaluator="xml" expression="$ctx:ComsResponse"/>
    </args>
</payloadFactory>
<property name="ContentType" scope="axis2" type="STRING" value="text/html"/>
<property name="messageType" scope="axis2" type="STRING" value="text/html"/>
<call/>
<property action="remove" name="To" scope="transport"/>
</sequence>

报错日志参考

报错日志截图

根因分析

  • 收件人To头作用域配置错误:WSO2 EI的mailto传输发送器仅读取transport作用域下的To头识别目标邮件地址,原配置将To头设置在default作用域,传输层无法获取目标地址,因此无法推断对应传输协议。
  • 缺失空值校验:如果errorEmailRecipients参数提取失败为空,拼接出的mailto:地址无效,也会触发同类报错。
  • 全局传输配置缺失:若未在axis2.xml中启用mailto传输发送器,框架无法识别mailto协议,同样会抛出该错误。

修复步骤

  • 修正ErrorSeq序列配置,调整To头作用域、增加收件人非空校验、适配单向邮件发送场景,修正后代码如下:
<sequence name="ErrorSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
    <property expression="$ctx:token//*[local-name()='errorEmailRecipients']" name="errorEmailRecipients" scope="default" type="STRING"/>
    <!-- 校验收件人地址非空,避免无效地址调用 -->
    <filter xpath="normalize-space($ctx:errorEmailRecipients) != ''">
        <then>
            <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
            <property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
            <property name="Subject" scope="transport" type="STRING" value="Error While Processing Records"/>
            <!-- 核心修正:To头设置为transport作用域 -->
            <header expression="concat('mailto:', $ctx:errorEmailRecipients)" name="To" scope="transport"/>
            <payloadFactory media-type="xml">
                <format>
                    <root>
                        <html>
                            <body>
                                <p>There was an error While Processing Audio Record</p>
                                <p>Error Details: $1</p>
                            </body>
                        </html>
                    </root>
                </format>
                <args>
                    <arg evaluator="xml" expression="$ctx:ComsResponse"/>
                </args>
            </payloadFactory>
            <property name="ContentType" scope="axis2" type="STRING" value="text/html"/>
            <property name="messageType" scope="axis2" type="STRING" value="text/html"/>
            <!-- 单向邮件场景使用send mediator替代call,避免无意义的响应等待 -->
            <send/>
        </then>
    </filter>
    <property action="remove" name="To" scope="transport"/>
</sequence>
  • 检查全局mailto传输配置:打开WSO2 EI部署目录下的conf/axis2/axis2.xml文件,确认已配置启用mailto传输发送器,参考配置如下:
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
    <parameter name="mail.smtp.host">填写实际SMTP服务器地址</parameter>
    <parameter name="mail.smtp.port">填写SMTP服务端口(通常为25/465/587)</parameter>
    <parameter name="mail.smtp.auth">true</parameter>
    <parameter name="mail.smtp.user">填写发件人邮箱账号</parameter>
    <parameter name="mail.smtp.password">填写发件人邮箱密码或授权码</parameter>
    <parameter name="mail.smtp.starttls.enable">true</parameter>
    <parameter name="mail.smtp.from">填写发件人完整邮箱地址</parameter>
</transportSender>
  • 所有配置修改完成后,重启WSO2 EI服务使配置生效。

内容的提问来源于stack exchange,提问作者Thamu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.30 04:09:16