<p>I'm guessing if you update to the latest 3.x release of <a href="https://github.com/vlucas/phpdotenv/releases" rel="nofollow noreferrer">phpdotenv</a>, the issue will resolve itself.</p>

<p>3.x added better support for environment variables running in multi-threaded environments.  You can read some background info here: 
 <a href="https://github.com/craftcms/cms/issues/3631" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/3631</a></p>

<p>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: <a href="https://github.com/vlucas/phpdotenv/blob/master/UPGRADING.md" rel="nofollow noreferrer">https://github.com/vlucas/phpdotenv/blob/master/UPGRADING.md</a></p>

CC BY-SA 4.0
2019-09-12T14:16:24.720Z
I moved my email details out of dotenv and saved them directly in the CP and the issue persists.
CreateSean
CC BY-SA 4.0
2019-09-11T22:06:37.237Z
2019-09-11T22:06:37.237Z
Brad Bell
<p>Craft 3.3.0.1
Express Forms 1.0.4</p>

<p>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.</p>

<p>Sending a test email via <strong>settings > email</strong> works as expected as does a different Express Forms form, but this one does not and I am flummoxed.</p>

<p>when I check the Express forms log I see this:
<a href="https://i.sstatic.net/oIxvw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oIxvw.png" alt="enter image description here"></a></p>

<p>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.</p>

<pre><code>{# 
// 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 #}
    "test@domain.com", "test2@domain.com"
  {% endfor %}
{% endset %}

{# this testing div outputs emails as expected #}
&lt;div class="testing"&gt;
  {{ sendEmailAddress }}
&lt;/div&gt;&lt;!-- /.testing --&gt;


{% set form = craft.expressforms.form("jobapplication") %}


{# General Error Handling #}
{% if not form.valid %}
    &lt;div class="alert alert-danger" role="alert"&gt;
        {{ "Error! Please review the form and try submitting again."|t }}
        {% if form.errors|length %}
            &lt;ul&gt;
                {% for error in form.errors %}
                    &lt;li&gt;{{ error|t }}&lt;/li&gt;
                {% endfor %}
            &lt;/ul&gt;
        {% endif %}
    &lt;/div&gt;
{% endif %}


{{ form.openTag({
   return: '?success=1',
   dynamicNotifications: {
      to: [sendEmailAddress],
      template: "job-application.twig",
   }
}) }}

  {# 
    Various Fields here
  #}

  &lt;button type="submit" data-application-submit class="btn btn-default" disabled&gt;{{ "contact_submit"|t }}&lt;/button&gt;

{{ form.closeTag }}
</code></pre>

<p>I've tried various approaches to using <a href="http://craft.express/forms/v1/overview/email-notifications.html#types" rel="nofollow noreferrer">dynamic emails notifications</a> but nothing seems to work.</p>

<p>My email notification template looks like this where <code>{eMail}</code> is the email field name in the form.</p>

<pre><code>---
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
---
&lt;p&gt;The following submission came in on {{ dateCreated|date('l, F j, Y \\a\\t g:ia') }}.&lt;/p&gt;

&lt;ul&gt;
    {% for field in form.fields %}
        &lt;li&gt;&lt;strong&gt;{{ field.label }}:&lt;/strong&gt; {{ field.valueAsString }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;
</code></pre>

<p>Please advise.</p>

CC BY-SA 4.0
2019-09-07T00:03:57.877Z
I'm guessing the system email address is coming from an environment variable?  If so, are you using dotenv?
Brad Bell
CC BY-SA 4.0
2019-09-09T12:48:29.753Z
@BradBell Yes and yes.
CreateSean
<solspace><plugin-expressforms>
Express Forms Not Sending Notification Emails
# Express Forms Not Sending Notification Emails

(Asked by: username_0 on 2019-09-04)

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 #}
    "test@domain.com", "test2@domain.com"
  {% endfor %}
{% endset %}

{# this testing div outputs emails as expected #}

  {{ sendEmailAddress }}



{% set form = craft.expressforms.form("jobapplication") %}


{# General Error Handling #}
{% if not form.valid %}
    
        {{ "Error! Please review the form and try submitting again."|t }}
        {% if form.errors|length %}
            
                {% for error in form.errors %}
                    {{ error|t }}
                {% endfor %}
            
        {% endif %}
    
{% endif %}


{{ form.openTag({
   return: '?success=1',
   dynamicNotifications: {
      to: [sendEmailAddress],
      template: "job-application.twig",
   }
}) }}

  {# 
    Various Fields here
  #}

  {{ "contact_submit"|t }}

{{ 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
---
The following submission came in on {{ dateCreated|date('l, F j, Y \\a\\t g:ia') }}.


    {% for field in form.fields %}
        {{ field.label }}: {{ field.valueAsString }}
    {% endfor %}


Please advise.

**Tags:** solspace, plugin-expressforms

> **Comments:**
> **username_1**: I'm guessing the system email address is coming from an environment variable?  If so, are you using dotenv?  
> **username_0**: @BradBell Yes and yes.  

---

## 1 answers

### Answer by username_1 on 2019-09-11. Score: 0

I'm guessing if you update to the latest 3.x release of [phpdotenv](https://github.com/vlucas/phpdotenv/releases), 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>

> **Comments:**
> **username_0**: I moved my email details out of dotenv and saved them directly in the CP and the issue persists.  

---

