Allow null sender for contact form

Created on 15 November 2023, 8 months ago
Updated 12 June 2024, 16 days 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 7 months 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 7 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.69.0 2024