fusion-form icon indicating copy to clipboard operation
fusion-form copied to clipboard

Recipient mail without a name lead to an error

Open Benjamin-K opened this issue 2 months ago • 0 comments

Problem description

When using the Neos.Fusion.Form.Runtime:Email action, the EmailAction expects some defaults to be set or sets null as fallback. This is fine for most of the values. However, an unset senderName or recipientName now leads to an error, because new Symfony\Component\Mime\Address($mail, $name) expects the name to be a string (the default is an empty string).

Current behaviour

# fusion code
form = Neos.Fusion.Form:Runtime.RuntimeForm {
    # other code

    action {
        mail {
            type = 'Neos.Fusion.Form.Runtime:Email'
            options {
                senderAddress = '[email protected]'
                replyToAddress = ${data.email}
                recipientAddress = '[email protected]'
                subject = 'My Subject
                text = 'New message'
                html = '<h3>New message</h3>'
            }
        }
    }
}

throws the following exception:

Exception [0] in line 79 of /var/www/html/neos/live/releases/20251010103702/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_Fusion_Form_Runtime_Action_EmailAction.php: Symfony\Component\Mime\Address::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/neos/live/releases/20251010103702/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_Fusion_Form_Runtime_Action_EmailAction.php on line 79

Expected behaviour

The default value for the senderName and recipientName are set to an empty string, so they do not have to be set to an empty string explicitly. Especially when comparing the usage of recipientAddress being an array (so no name is available) to the usage with a single value, this makes no sense.

Benjamin-K avatar Oct 10 '25 09:10 Benjamin-K