Craft CMS Asked by CreateSean on December 31, 2020
Craft 3.3.0.1
Express Forms 1.0.4
I have an Express Forms set up. It submits and saves entries to the DB which can be viewed in the CP, however email notifications are not sent.
Sending a test email via settings > email works as expected as does a different Express Forms form, but this one does not and I am flummoxed.
when I check the Express forms log I see this:
Here is a simplified template of my form where you can see the notification email address are set to a field in the page entry or if that is empty default email addresses are used.
{#
// set send email address from careers entry
#}
{% set sendEmailAddress %}
{# loop through emails from job entry page and set the form to send to those emails #}
{% for email in entry.applicationEmails %}
"{{ email.emailAddress }}"{% if not loop.last %},{% endif %}
{% else %}
{# if empty send to this address #}
"[email protected]", "[email protected]"
{% endfor %}
{% endset %}
{# this testing div outputs emails as expected #}
<div class="testing">
{{ sendEmailAddress }}
</div><!-- /.testing -->
{% set form = craft.expressforms.form("jobapplication") %}
{# General Error Handling #}
{% if not form.valid %}
<div class="alert alert-danger" role="alert">
{{ "Error! Please review the form and try submitting again."|t }}
{% if form.errors|length %}
<ul>
{% for error in form.errors %}
<li>{{ error|t }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{{ form.openTag({
return: '?success=1',
dynamicNotifications: {
to: [sendEmailAddress],
template: "job-application.twig",
}
}) }}
{#
Various Fields here
#}
<button type="submit" data-application-submit class="btn btn-default" disabled>{{ "contact_submit"|t }}</button>
{{ form.closeTag }}
I’ve tried various approaches to using dynamic emails notifications but nothing seems to work.
My email notification template looks like this where {eMail}
is the email field name in the form.
---
name: 'Job Application Email Notification Template'
description: 'submits job applications to reciever'
fromName: 'Strongco'
fromEmail: '$SYSTEM_EMAIL'
replyTo: '{eMail}'
cc: null
bcc: null
subject: 'Job Application: {positionAppliedFor}'
includeAttachments: true
---
<p>The following submission came in on {{ dateCreated|date('l, F j, Y at g:ia') }}.</p>
<ul>
{% for field in form.fields %}
<li><strong>{{ field.label }}:</strong> {{ field.valueAsString }}</li>
{% endfor %}
</ul>
Please advise.
I'm guessing if you update to the latest 3.x release of phpdotenv, the issue will resolve itself.
3.x added better support for environment variables running in multi-threaded environments. You can read some background info here: https://github.com/craftcms/cms/issues/3631
Note that you'll likely need to update how phpdotenv is loaded in your public index.php file. You can read the upgrade guide here: https://github.com/vlucas/phpdotenv/blob/master/UPGRADING.md
Answered by Brad Bell on December 31, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP