[emails] Duplicate attachments in emails [5.2.0]
Only In-Portal 5.2.0 and above are affected.
Each e-mail that can be sent out needs to be specified upfront in the "Website & Content > E-mail Templates
" section. The e-mail template configuration form contains following fields:
- Template Name - unique key, that can be used by developer to reference this e-mail template
- Subject - the email subject
- HTML Version - the HTML version of email body
- Text Version - the text version of email body
It is possible to use In-Portal in email subject and body and this feature allows developers to make e-mails as dynamic as possible. There is also a tag that allows to make attachments to the email:
<inp2:m_AttachFile path="..."/>
When e-mail only has HTML version of the body specified, then Text Version is reconstructed from it which requires another parsing of HTML version. This in turn invokes the "m_AttachFile" tag again and final e-mail would have same file attached twice. This is a problem in the 1st place, because In-Portal shouldn't have any tags, that modify the data in the first place.
Solution
The "kEmailSendingHelper::AddAttachment
" method needs to only add new e-mail part (call the "AddPart
" method), when no part with exactly same definition exists in that email already.