简体   繁体   中英

Mule ESB - SMTP Subject from a variable

I'm working on a flow to send an attached file to a mail.

<smtp:outbound-endpoint host="${instance.smtp.host}" port="${instance.smtp.port}" user="${instance.smtp.user}" password="${instance.smtp.password}" responseTimeout="10000" doc:name="SMTP" connector-ref="SMTP" from="${instance.smtp.account}"  to="${instance.smtp.user}" subject="Transaction ID #[flowVars.transactionId]"/>

Everything is working well, I already have tested my flow and the mails are arriving to the specified mail address, however, I'm trying to modify the subject dynamically, using a value stored in a variable, and then the problem appears, seems like it's not possible to use my expression to set the subject's mail.

subject="Transaction ID #[flowVars.transactionId]"

This is the error I'm getting.

Root Exception stack trace:

[Error: unresolvable property or identifier: Transaction] [Near : {... Transaction ID #[flowVars.tran ....}] ^

Do you have any clue about this problem or how can I fix it?

Thanks in advance.

在到达SMTP消息源之前,请调试应用程序并测试是否已设置“ transactionId”的流变量。

You need to rearrange the expression so all of it is within the #[....]

subject="#['Transaction ID ' + flowVars.transactionId]"

Some fields get parsed as MEL expressions and some are more like templated strings that allow expression substitutions.

(One of Mule's annoyances)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM