Sterc / FormIt

A dynamic form processing Snippet for MODX Revolution
https://docs.modx.com/current/en/extras/formit
33 stars 58 forks source link

Don't reset $modx->mail in the autoresponder #240

Closed Jako closed 3 years ago

Jako commented 4 years ago

What does it do?

Don't reset $modx->mail in the autoresponder.

Why is it needed?

The autoresponder could have string based attachments with the following code in a hook before FormItAutoResponder without the reset.

    $pdf = …

    /** $mail modPHPMailer */
    $hook->modx->getService('mail', 'mail.modPHPMailer');
    $hook->modx->mail->mailer->addStringAttachment($pdf, 'attachment.pdf');

Since $modx->mail is reset in the email hook (https://github.com/Sterc/FormIt/blob/develop/core/components/formit/src/FormIt/Hook/Email.php#L315-L318), the reset is not necessary in the autoresponder.

Related issue(s)/PR(s)

none