Replace mail urls
Description
This scriptlet is used to change an HTML message text from an email body to be stored in a Valuemation database.
All references to images like <img src="cid:file1.png@soffico.de" alt="file 1"> are changed to something like:
<vmweb?task=img&xst=attname&moniker=M_DataInput-1|23&path=_vm_rte_1.PNG&xts=1415619728012>
Furthermore, the changed references are stored in the image messages under the property name "Valuemation-URL".
To be more flexible, the pattern used when searching for image references can be changed in the script body.
By default, the following pattern is used:
<img[^>]*?src\s*=["'](cid:.*?)["'][^>]*?>
It should be replaced by:
<vmweb?task=img&xst=attname&moniker=M_DataInput-1|23&path=_vm_rte_$(IDX).$(TYP)&xts=$(TS)>
Where:
$(CNT)is replaced by the position of the reference; the first reference has position 1, the second 2, and so on.$(TYP)is replaced by the subtype of the Content-Type property of the referenced image message; e.g., jpg or png.$(TS)is replaced by the current timestamp in milliseconds.$(IDX)is replaced by the position of the referenced message in the message list.
Create
Configuration
Properties and Parameter assignment
The assignment sections define the variable connection between the script execution and process model.
The following parameters are required.
**Ingoing parameters**:
- **HTMLMSG**: message whose content contains image references; typically an HTML message.
- **IMAGES**: a messagelist; each message in the list is a binary message containing an image.
Every message **MUST** have the properties `Content-Type` and `Content-ID`. Therefore, this message list typically is returned by the EMail Listener adapter.
*Outgoing parameters**:
- **HTMLMSG**: changed HTMLMSG message.
- **IMAGES**: the list of images where every message has the property `Valuemation-URL` set.
