# Docker Setup Not Sending Email

**URL:** <https://community.passbolt.com/t/docker-setup-not-sending-email/587>\
**Category:** Installation Issues\
**Created:** [April 17, 2018, 11:45pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587 "2018-04-17T23:45:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 17, 2018, 11:45pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/1 "2018-04-17T23:45:12Z")

</div>

Everything in my passbolt docker container seems to be running fine besides sending email through google smtp. I’ll be posting my ./bin/cake tests below, but first off can anyone validate my variables in my docker run? BTW I’m utilizing nginx-proxy and nginx-letsencrypt-companion for auto https and reverse proxy.

```
docker run --detach \
    --name passbolt \
    --restart always \
    --env TZ=America/Denver \
    --env APP_FULL_BASE_URL=https://password.example.com \
    --env PASSBOLT_SSL_FORCE=false \
    --env EMAIL_TRANSPORT_DEFAULT_CLASS_NAME=Smtp \
    --env EMAIL_DEFAULT_FROM=noreply@example.com \
    --env EMAIL_DEFAULT_TRANSPORT=Smtp \
    --env EMAIL_TRANSPORT_DEFAULT_HOST=smtp.gmail.com \
    --env EMAIL_TRANSPORT_DEFAULT_PORT=587 \
    --env EMAIL_TRANSPORT_DEFAULT_TLS=true \
    --env EMAIL_TRANSPORT_DEFUALT_USERNAME=noreply@example.com \
    --env EMAIL_TRANSPORT_DEFAULT_PASSWORD=password \
    --env PASSBOLT_KEY_EMAIL=admin@example.com \
    --env DATASOURCES_DEFAULT_HOST=passboltdb \
    --env DATASOURCES_DEFAULT_PASSWORD=password \
    --env DATASOURCES_DEFAULT_USERNAME=mypassbolt \
    --env DATASOURCES_DEFAULT_DATABASE=mypassbolt \
    passbolt:local

```

Running `su -s /bin/bash -c "./bin/cake passbolt healthcheck" www-data` from withing the container generates the following non “PASS” entries:

```
[WARN] The passbolt config file is missing in /var/www/passbolt/config/
 [HELP] Copy /var/www/passbolt/config/passbolt.php.default to /var/www/passbolt/config/passbolt.php
 [HELP] The passbolt config file is not required if passbolt is configured with environment variables

# to be expected since I'm using reverse proxy to handle SSL
[FAIL] Passbot is not configured to force SSL use.
 [HELP] Set passbolt.ssl.force to true in config/passbolt.php.

```

Running `./bin/cake EmailQueue.preview` results in:

```
Email :
Exception: Transport config "Smtp" is missing. in [/var/www/passbolt/vendor/cakephp/cakephp/src/Mailer/Email.php, line 1582]

```

Line 1582 regarding the error above:

```
throw new InvalidArgumentException(sprintf('Transport config "%s" iss missing.', $name));

```

`cat /var/log/cron.log`

```
Exception: Transport config "Smtp" is missing. in [/var/www/passbolt/vendor cakephp/cakephp/src/Mailer/Email.php, line 1582]

```

`./bin/cake passbolt send_test_email`

```
Email configuration
---------------------------------------------------------------
Host: smtp.gmail.com
Port: 587
Username: 
Password: *********
TLS: true

Sending email from: noreply@example.com
Sending email to: doesnotexist@passboltdummydomain.com
---------------------------------------------------------------
Exception: Transport config "Smtp" is missing. in [/var/www/passbolt/vendor/cakephp/cakephp/src/Mailer/Email.php, line 1582]
```

---

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 19, 2018, 11:53pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/2 "2018-04-19T23:53:45Z")

</div>

Results with `telnet smtp.gmail.com 587`:

```
root@da86fcfe8844:/var/www/passbolt# telnet smtp.gmail.com 587
Trying 173.194.203.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP 204sm9750747pgf.61 - gsmtp
quit
221 2.0.0 closing connection 204sm9750747pgf.61 - gsmtp
Connection closed by foreign host.

```

Anyone have an idea here? I hate to reply to my own thread, but if anyone could at least validate my run command looks fine that would be something. Thanks.

---

<div class="post-metadata">

**Author:** ![diego](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/diego/32/16_2.png) [@diego](https://community.passbolt.com/u/diego)\
**Post date:** [April 20, 2018, 8:00am UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/3 "2018-04-20T08:00:32Z")

</div>

Hello @rhett sorry that nobody answered I will try to reproduce your issue and come back at you with more details!

---

<div class="post-metadata">

**Author:** ![diego](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.passbolt.com/diego/32/16_2.png) [@diego](https://community.passbolt.com/u/diego)\
**Post date:** [April 20, 2018, 8:46am UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/4 "2018-04-20T08:46:24Z")

</div>

> [@rhett](#):
>
> EMAIL\_DEFAULT\_TRANSPORT=Smtp

I think that is the problem. That env variable should be either not declared or declared with value ‘default’ as it points to the app.php EMAIL\_TRANSPORT profile which is by default called ‘default’ (Unless you are defining a different EMAIL\_TRANSPORT profile in app.php. In that case, you should declare the variable with the appropriate name of the profile you defined)

Also the following variable does not need to be declared since the default value is already ‘Smtp’ (it doesnt hurt to declare it as you did though):

> [@rhett](#):
>
> EMAIL\_TRANSPORT\_DEFAULT\_CLASS\_NAME=Smtp

Hope this helps to solve your problem!

Bonus points: Regarding the failures you mention on the healthcheck we are already working on a fix for them 🙂

---

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 21, 2018, 12:51am UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/5 "2018-04-21T00:51:33Z")

</div>

Thanks, diego. I appreciate your help.

It appears I’m going in the right direction. However, I’m receiving the following error which seems password related, but I’ve verified my password, allowed less secure apps, and I’m using the same email in other docker containers for smtp.

Here’s what I’m getting:

```
 Debug email shell
---------------------------------------------------------------

Email configuration
---------------------------------------------------------------
Host: smtp.gmail.com
Port: 587
Username:
Password: *********
TLS: true

Sending email from: noreply@example.com
Sending email to: doesnotexist@passboltdummydomain.com
---------------------------------------------------------------

Trace
[220] smtp.gmail.com ESMTP l5-v6sm5678156qtp.91 - gsmtp
> EHLO localhost
[250] smtp.gmail.com at your service, [this.is.an.ip.address]
[250] SIZE 35882577
[250] 8BITMIME
[250] STARTTLS
[250] ENHANCEDSTATUSCODES
[250] PIPELINING
[250] CHUNKING
[250] SMTPUTF8
> STARTTLS
[220] 2.0.0 Ready to start TLS
> EHLO localhost
[250] smtp.gmail.com at your service, [this.is.an.ip.address]
[250] SIZE 35882577
[250] 8BITMIME
[250] AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
[250] ENHANCEDSTATUSCODES
[250] PIPELINING
[250] CHUNKING
[250] SMTPUTF8

A test email could not be sent.
Error: SMTP Error: 530 5.5.1 https://support.google.com/mail/?p=WantAuthError l5-v6sm5678156qtp.91 - gsmtp

```

I’ve triple-checked the user name and password. I’ll continue to investigate.

---

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 26, 2018, 12:29am UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/6 "2018-04-26T00:29:13Z")

</div>

When running `./bin/cake passbolt send_test_email` is it supposed to show something aside “Username:”? As you can see in my output above it’s blank.

`cat /var/log/cron.log` shows the following:

```
SMTP Error: 530 5.5.1 https://support.google.com/mail/?p=WantAuthError r68sm31799361pfi.174 - gsmtp
Email 1 was not sent
Notice Error: Trying to get property 'url' of non-object in [/var/www/passbolt/src/Template/Email/html/AN/user_register_self.ctp, line 22]

2018-04-26 00:13:01 Notice: Notice (8): Trying to get property 'url' of non-object in [/var/www/passbolt/src/Template/Email/html/AN/user_register_self.ctp, line 22]

```

Here’s the user\_register\_self.ctp line 22:

```
echo $this->element('Email/module/avatar',[
    'url' => Router::url(DS . $user->profile->avatar->url['small'], true), ### LINE 22
    'text' => $this->element('Email/module/avatar_text', [
        'username' => Purifier::clean($user->username),
        'first_name' => Purifier::clean($user->profile->first_name),
        'last_name' => Purifier::clean($user->profile->last_name),
        'datetime' => $user->created,
        'text' => __('You have just created your account on passbolt!')
    ])
]);

```

Any have ideas?

---

<div class="post-metadata">

**Author:** ![mannp](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mannp](https://community.passbolt.com/u/mannp)\
**Post date:** [April 26, 2018, 10:03am UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/7 "2018-04-26T10:03:40Z")

</div>

@rhett this is from my working config;

---

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 26, 2018, 5:28pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/8 "2018-04-26T17:28:58Z")

</div>

@mannp, thanks.

If I run `grep -rnw '/var/www/passbolt' -e 'smtp.gmail.com'`, I get no results, so I think if you use docker run and assign variables it doesn’t show in the configuration files.

Does `./bin/cake passbolt send_test_email` show an actual user name for you? Sorry for all the questions. I’m wondering if I’d have less hassle using docker compose, or if I missed something simple.

---

<div class="post-metadata">

**Author:** ![mannp](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mannp](https://community.passbolt.com/u/mannp)\
**Post date:** [April 26, 2018, 6:20pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/9 "2018-04-26T18:20:24Z")

</div>

@rhett my understanding is that the docker env variables don’t get added to passbolt.php, but instead they are parsed in default.php and are actioned by the code accordingly.

I was confused about this previously, but if you look at the code in default.php you can see the env variables are used in that file.

I have a combination of both but do have my email configured purely in passbolt.php.

That command shows the full messages between passbolt and gmail and ends in a sucessful send.

---

<div class="post-metadata">

**Author:** ![rhett](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@rhett](https://community.passbolt.com/u/rhett)\
**Post date:** [April 27, 2018, 9:47pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/10 "2018-04-27T21:47:14Z")

</div>

I’m getting the exact errors when using docker-compose. I know my sign in credentials are correct. The email I’m using does not have 2 factor authorization on. I’ve allowed less secure apps and the captcha unlock didn’t help either: [https://accounts.google.com/b/0/DisplayUnlockCaptcha](https://accounts.google.com/b/0/DisplayUnlockCaptcha)

Can anyone tell me what the `EMAIL_TRANSPORT_DEFAULT_URL` environment variable is? I have a notice as shown above complaining about an URL.

Thanks,

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/passbolt/original/2X/b/bee7d3f9329f668000d46e9fcb2e5db1e9d31348.svg) [@system](https://community.passbolt.com/u/system)\
**Post date:** [May 2, 2018, 9:47pm UTC](https://community.passbolt.com/t/docker-setup-not-sending-email/587/11 "2018-05-02T21:47:18Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
