Email sending hangs on very large emails

Description

Hi Tibor!

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.

Regards,
Máté

Environment

None

Preliminary Test Cases

None

Assignee

Tibor Hegyi

Reporter

Mate Smajda

Labels

None

Access to limited visibility issues

None

Product platform

None

Module Dependency

None

Fix versions

Affects versions

Priority

Major
Configure