solspace / craft-express-forms

Express Forms for Craft: Intuitive and lightweight form builder that gets the job done but doesn’t get in your way.
https://docs.solspace.com/craft/express-forms/v2/
Other
13 stars 4 forks source link

Craft 4 - Express Forms saves submissions but won't send email notifications #232 #100

Closed bjprodneyl closed 2 years ago

bjprodneyl commented 2 years ago

Describe the bug or issue you're experiencing Running Express Forms 2.0.0-beta.2 on

Have setup Express Forms. Submissions save, but email notifications fail. We are running the form using an email address we setup on our server via smtp, but have also tried the sendmail option but get same error Steps to reproduce

Steps to reproduce

1.Submit form

  1. Check email and spam folders
  2. Check Express Forms log ans see this error: Email notification [express_forms_demo_notification.twig]: Email "" does not comply with addr-spec of RFC 2822. [] []

Expected behavior Expect email notifications to send but not workiing Craft & Plugin Info (please complete the following information):

Additional context

Craft version: Craft CMS 4.2.3 (Pro)
PHP version: 8.1.9
Database driver & version: MySQL 10.2.44
Plugins & versions: Express Forms 2.0.0-beta.2
kjmartens commented 2 years ago

Hi @bjprodneyl,

Can you share with me what your email notification template and form (screenshot in CP form builder) looks like? I wonder if there's a syntax error or possibly an incorrect value entered. 🙂

rydncn commented 2 years ago

I've ran into this issue too since working on Craft 4 sites and using the Lite version of the plugin. I narrowed it down to being the From Name and From Email fields in the Email Notification Template.

I removed the following:

I then had to add in the name and email address into the fields instead of using the settings above.

I haven't had a chance to test and see why this is happening unfortunately but I'm not sure if this is due to a Craft 4 change at some stage that has caused an issue with retrieving the email data from the settings.

If I get a chance to investigate this further I'll update this thread with any findings.

Hope this helps anyone as a workaround for now!

kjmartens commented 2 years ago

@rydncn This is because Craft 4 no longer allows the systemSettings approach. It needs to be updated to projectConfig instead:

fromName: '{{ craft.app.projectConfig.get("email.fromName") }}'
fromEmail: '{{ craft.app.projectConfig.get("email.fromEmail") }}'

🙂

rydncn commented 2 years ago

@kjmartens Ah! Thanks for the info. Will the EmailNotification.php model be updated to match that or will it be like this until the plugin no longer supports Craft 3?

kjmartens commented 2 years ago

@rydncn Good catch! I will update that file as well. 🙂

thisisjamessmith commented 1 year ago

Please can you get this updated in the docs too? https://docs.solspace.com/craft/express-forms/v1/overview/email-notifications/#submitter-2

kjmartens commented 1 year ago

Please can you get this updated in the docs too? https://docs.solspace.com/craft/express-forms/v1/overview/email-notifications/#submitter-2

Sure, updating now. It was updated for the v2 docs, but v1 will include it as well. 🙂