简体   繁体   中英

Mule: SMTP endpoint full mailto: instead of to, subject attributes

I have access to a string for an smtp endpoint that looks like this: mailto:someone@example.com?subject=This%20is%20the%20subject&cc=someone_else@example.com

I could parse the string to extract the to, and subject attributes and use those with my smtp endpoint, however, I bet there is just a way to pass this whole string to the endpoint, but I haven't found it. I have tried using the address attribute, but it expects an smtp://[host]:[port] URI, so I'm not sure it could be used for this.

Has anyone succeeded in passing a valid mailto: URI to the Mule SMTP endpoint?

If this doesn't work, then I'll need to parse the string, I could use android.net.MailTo, which is a class that parses a mailto: URI, as an alternative, if no tool is available from Mule to do this.

使用%40代替@ ... ...没有其他方法可以解析此示例:-aka11@gmail.com可以写为aka11%40gmail.com

This worked for me:

On the flow:

<outbound-endpoint address="${alertmail.address}" doc:name="Generic4">
    <properties>
        <spring:entry key="subject" value="${alertemail.subject}" />
    </properties>
</outbound-endpoint>

And on the properties file (replacing mailserver , user and domain by proper values):

alertmail.address=smtp://mailserver?address=user@domain

Copied the structure of the URI from here:

http://www.mulesoft.org/documentation-3.2/display/MULE2USER/SMTP+Transport

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