When we try to send emails with very large body with lots of images, it hangs for a very long time causing overall system slowness.
Out performance monitoring tool showed that the problem occurs when JETI tries to replace image links with cids in SmartEmail.referImageLinkToPart:
body = body.replaceAll("(?i)(?s)(<img
s.?src.?=.?)(" + link + ")(.?>)", "$1" + "cid:" + cid + "$3");
It had been executing for 2 hours when we had killed the process as it slowed down our system.
Could you please try to optimize the performance of this regex?
I attached a screenshot from our monitoring tool.