The vulnerability is a classic HTML injection flaw caused by a failure to use sanitized data. The root cause is located in the modules/photos/ecard_send.php script. This script correctly invokes the form validation and sanitization process (using HTMLPurifier), but then discards the sanitized ecard_message and instead uses the raw value directly from the $_POST superglobal.
This unsanitized input is then passed to the ECard::parseEcardTemplate method. This method performs a simple string replacement to place the message into the eCard's HTML template, without applying any form of output encoding. This allows an authenticated attacker to inject arbitrary HTML, including phishing links or JavaScript payloads, into emails sent to other users.
The patch, found in commit 931c0a77ccf0f9130273e7eb76a2d5e4506bc2a1, resolves the vulnerability by removing the line that captures the raw POST data and instead correctly using the sanitized $formValues['ecard_message'] when calling parseEcardTemplate. This ensures that only safe, validated HTML is included in the eCard.