Allow null sender for contact form

Created on 15 November 2023, about 1 year ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

When not logged in, it seems that trying to send a contact form automatically adds the anonymous user empty email address to the "addresses" array of the email object (in reply-to I think).

Proposed resolution

Prevent getSymfonyEmail() from adding empty addresses ?
It should be fixed at the source - i.e. in this case, in the contact form module, but it could be worth not breaking the sending of any email with multiple addresses due to one empty email.

Feature request
Status

Active

Version

1.4

Component

Code

Created by

🇫🇷France Paulmicha Porto Alegre, RS, Brasil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Paulmicha
  • 🇫🇷France Paulmicha Porto Alegre, RS, Brasil

    Current workaround : cf. patch attached.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇬🇧United Kingdom adamps

    I can't reproduce this. When sending as anonymous then there is a box to put your email address in. Perhaps you have disabled the field on your site?

  • 🇫🇷France Paulmicha Porto Alegre, RS, Brasil

    Indeed, could it be that the switch from Swiftmailer to Symfony Mailer has introduced these fields ?
    In our case, it seems preferable not to add those fields to the existing forms.

  • Status changed to Active 12 months ago
  • 🇬🇧United Kingdom adamps

    Indeed, could it be that the switch from Swiftmailer to Symfony Mailer has introduced these fields ?

    No, the field I refer to is part of Core.

    In our case, it seems preferable not to add those fields to the existing forms.

    Interesting I'm surprised that it worked without using this module. I had imagined that this field is mandatory.

    I believe that the right fix is in ContactEmailBuilderBase

    - if ($email->getSubType() == 'mail') {
    + if ($sender && $email->getSubType() == 'mail') {
    
  • 🇳🇱Netherlands mrcdrx

    I can confirm that the patch in #2 works.

Production build 0.71.5 2024