Sterc / FormIt

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

Unusual display of MIME/Header info in emails received from FormIt email Hook #269

Closed andrewcsp closed 9 months ago

andrewcsp commented 2 years ago

Bug report

Summary

Disclaimer: Possible this is limited to just MODX Cloud and PHP 8.1 (I've not seen this issue on other sites I manage).

I have a website hosted on MODX Cloud. It contains a FormIt call which sends out an email whenever it is submitted:

&emailTpl=`emailContact`
&emailSubject=`...`
&emailTo=`...`
&emailBCC=`...`
&emailFrom=`...`
&emailHtml=`0`

Each time I receive these emails it appears the "emailContact" chunk has been partially processed before some sort of interruption displaying some headers/charset information. For example, the chunk contents are:

ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Form submission to the Contact Form

First Name: [[+firstname]]
Last Name: [[+lastname]]

...

Step to reproduce

Create a FormIt call with email parameters similar to the above. Please note, I am only able to reproduce the issue on MODX Cloud with PHP 8.1. I haven't seen it with my own self-hosted MODX sites (regardless of PHP version).

Observed behavior

The email I receive from the contact form contains fragmented headers/charset information mixed into the chunk, for example:

ABCDEFGHIJKLMNOplain; charset=UTF-8

ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Form submission to the Contact Form

First Name: Test
Last Name: Test

...

Expected behavior

I wouldn't expect to see any headers/charset information in the email notification.

Environment

MODX 2.8.4-pl FormIt 4.2.7-pl MODX Cloud, US-Texas location PHP Version 8.1.5

andrewcsp commented 2 years ago

Also note, the output varies slightly each time. For example, a second test began with "MIME-Versiset" and got to the letter "L" in the alphabet instead of "O" in my opening post:

MIME-Versiset=UTF-8

ABCDEFGHIJKLxt/plain; charset=UTF-8

ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

Form submission to the Contact Form

First Name: Test
Last Name: Test
andrewcsp commented 2 years ago

In addition, as well as PHP Version 8.1.5, I can confirm that I'm seeing the same issue on PHP 8.0.18. The issue does not appear for me in PHP 7.4.29. All tested on the same development environment in MODX Cloud.

Let me know if there's anything else I can do to help debug the problem.

matdave commented 2 years ago

I'm seeing something similar on a PHP 7.4 environment

matdave commented 2 years ago

I found the issue. It was PDOTools. I disabled its custom parser, and the form is working again. To disable, I just went into the database and changed the modx_system_settings entries for parser_class and parser_class_path to have a suffix of _disabled. Alternatively, you can just delete them if you notice it on another site.

matdave commented 2 years ago

I may have spoke too soon. I'm seeing this issue pop up again with the parser disabled.

MrRoco commented 9 months ago

Hey Guys,

Sadly not able to reproduce this issue, it appears to be a Cloud issue. You maybe can try to clean out the mail chunk and in steps add back your data to see if there's anything that will break.