verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
94 stars 72 forks source link

Email Notifications Failing #393

Closed jwrudzin closed 3 years ago

jwrudzin commented 3 years ago

Description Email notifications are not sending properly. The task shows "failed" and the error is:

Failed to send notification email: {"error":"Notification email template parse error for “”. Template error: “The directory does not exist: /MYSITEPATH/web/assets” /MYSITEPATH/vendor/yiisoft/yii2/web/AssetManager.php:213"}.

Everything else seems to be working properly (submission is logged in the CMS, and the MailChimp integration we have in place is also working properly).

Form settings

Additional info

engram-design commented 3 years ago

Are you using a custom email template? If so, are you able to share (maybe a cut-down version) of your email template?

If not, what fields does your form contain? I would assume this might be related to a File Upload field if we're talking about assets.

I would also have a look at your storage/logs/formie.log file.

jwrudzin commented 3 years ago

We aren't using custom email templates. The form is an email field and a checkboxes field with 4 options.

I am seeing some relevant entries in the formie.log file:

2021-03-12 13:24:33 [-][-][-][error][formie] Failed to render email field content: Object of class craft\fields\data\MultiOptionsFieldData could not be converted to string 2021-03-12 13:24:33 [-][-][-][error][formie] Failed to render dynamic string “

{formName}{allFields}{timestamp}

”. Template error: “The directory does not exist: /home/forge/SITENAME/web/assets” /home/forge/SITENAME/vendor/yiisoft/yii2/web/AssetManager.php:213 2021-03-12 13:24:33 [-][-][-][error][formie] Notification email template parse error for “”. Template error: “The directory does not exist: /home/forge/SITENAME/web/assets” /home/forge/SITENAME/vendor/yiisoft/yii2/web/AssetManager.php:213 2021-03-12 13:24:33 [-][-][-][info][formie] Fail alert not configured to send. 2021-03-12 13:24:33 [-][-][-][info][application] $_GET = []

jwrudzin commented 3 years ago

Also in case it's helpful info, I'm seeing this same error on a different site that is not using multi-site.

engram-design commented 3 years ago

That Failed to render email field content: Object of class craft\fields\data\MultiOptionsFieldData could not be converted to string should've been fixed some time ago, so that's odd. I also can't replicate it.

I'm not quite sure what is requesting /home/forge/SITENAME/web/assets. From my testing, it should be trying to resolve /home/forge/SITENAME/web/cpresources, but that's about it. I'll have to do some more testing.

Are you doing anything with aliases, or resourceBasePath in your config/general settings?

jwrudzin commented 3 years ago

I'm not doing anything with resourceBasePath, but in general.php I do have:

'aliases' => [
  '@web' => getenv('SITE_URL'),
],
jwrudzin commented 3 years ago

@engram-design just checking in to see if you have any ideas here or if there's anything I can do to help troubleshoot further. Thanks!

engram-design commented 3 years ago

@jwrudzin Haven't gotten any further with this one, but not really sure what's the root of this problem.

Anything unusual about your site, like running headless?

Is it worth disabling all other plugins to see if there's some sort of conflict? You're the first person to report this specific issue, and I haven't come across it (or able to reproduce it).

Does the actual /MYSITEPATH/web/assets path exist on your server?

jwrudzin commented 3 years ago

@engram-design trying to nail down this issue further. It appears it's related to the version of PHP/Craft I'm running:

PHP: 7.1.33 Craft: 3.5.15.1

Updating to php 7.4.4 and Craft 3.6.11.2 fixes the issue.

Eventually we will be updating all of our sites to run PHP 7.4 and the latest version of Craft. In the meantime, can you suggest any workarounds that we can put in place to fix this, so that we can update Formie before we update PHP?

Appreciate your help!

engram-design commented 3 years ago

Thanks for confirming that, that's quite interesting. I haven't been able to replicate it (still) with your same PHP version and plugin/Craft versions however.

Does your project actually use /MYSITEPATH/web/assets by the way? Does this directory exist?

Would it be worth checking if running Craft: 3.5.15.1 in PHP 7.4.4 still has this issue, just so we can try to rule out behaviours?

engram-design commented 3 years ago

Going to close this one for the moment, as there's a solution with running Craft 3.6+ (which as of Formie 1.4.0, is required).