Bug #92902

TypoScript formDefinitionOverrides recipients

Added by Raphael Zschorsch about 1 year ago. Updated 4 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-11-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Overriding recipients in form framework in TYPO3 10 through TypoScript works in frontend, but the TypoScript analyzer in backend throws an error due to the @ symbol.

Configuration:

plugin.tx_form.settings.formDefinitionOverrides.contactForm.finishers {
    0 {
        options {
            recipients {
                test@test.de = Name
            }
        }
    }
}

Error/Warning in backend module "Template":
Warning : Line 4283: Object Name String, "" contains invalid character "@". Must be alphanumeric or one of: "_:-\." (edited)

#1

Updated by Raphael Zschorsch about 1 year ago

After further investigation, the @ symbol should be allowed by TypoScript parser.
https://github.com/TYPO3/TYPO3.CMS/blob/11c11675e62a8bdef428db63af291185fe35d4fc/typo3/sysext/form/Classes/Controller/FormFrontendController.php#L158

Also, the configuration needs to be:

plugin.tx_form.settings.formDefinitionOverrides.contactForm.finishers {
    0 {
        options {
            recipients {
                test@test\.de = Name
            }
        }
    }
}

The dot in the email address, has to be escaped, otherwise it won't work, as the dot notation of TypoScript kicks in. This is especially bad, if the email address is i.e. defined as a TypoScript constant without escaping the dot. I couldn't figure this out yet.

This won't work:

plugin.tx_form.settings.formDefinitionOverrides.contactForm.finishers {
    0 {
        options {
            recipients >
            recipients {
                test@test\.de = Name
            }
        }
    }
}

Clearing recipients in TypoScript will not work, because here the array is merged and the default value of the YAML form file is still in the array:
https://github.com/TYPO3/TYPO3.CMS/blob/11c11675e62a8bdef428db63af291185fe35d4fc/typo3/sysext/form/Classes/Controller/FormFrontendController.php#L158

Setting

recipients = __UNSET
will not work either.

#2

Updated by Ayke Halder 9 months ago

The following code variation works.

YAML form definiton:

finishers:
  -
    options:
      recipientAddress: default@example.org
      recipientName: Default Name

TypoScript setup:

plugin.tx_form.settings.formDefinitionOverrides.contactForm.finishers {
  0 {
    options {
      recipientAddress = special@example.com
      recipientName = Special Name
    }
  }
}
#3

Updated by Raphael Zschorsch 9 months ago

Yes, this works for TYPO3 9, but the YAML configuration changed to "recipients" in TYPO3 10.

https://docs.typo3.org/c/typo3/cms-core/10.2/en-us/Changelog/10.0/Feature-80420-AllowMultipleRecipientsInEmailFinisher.html

#4

Updated by Bjoern Jacob 4 months ago

  • Category deleted (Form Framework)

This is not related to form. It is a problem of the TypoScript parser. Anyway, thank you for your contribution and all of the provided information.

Also available in: Atom PDF