# Sending emal from Gmail

**URL:** <https://discuss.elastic.co/t/sending-emal-from-gmail/221012>\
**Category:** Kibana\
**Created:** [February 26, 2020, 10:43am UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012 "2020-02-26T10:43:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmu](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@rmu](https://discuss.elastic.co/u/rmu)\
**Post date:** [February 26, 2020, 10:43am UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/1 "2020-02-26T10:43:12Z")

</div>

Hello,

I am having siginificant problems trying to configure sending email from the GMail SMTP service.  
My configuration is as follows (not complete):

version: '3'  
services:  
es01:  
image: '[docker.elastic.co/elasticsearch/elasticsearch:7.5.1](http://docker.elastic.co/elasticsearch/elasticsearch:7.5.1)'  
container\_name: es01  
ports:  
- '9200:9200'  
restart: always  
environment:  
- node.name=es01  
- discovery.type=single-node  
- ELASTIC\_PASSWORD=$ELASTIC\_PASSWORD  
- bootstrap.memory\_lock=true  
- xpack.ml.enabled=false  
- 'ES\_JAVA\_OPTS=-Xms10240m -Xmx10240m'  
- xpack.security.enabled=true  
- xpack.security.http.ssl.enabled=true  
- xpack.security.http.ssl.key=$CERTS\_DIR/es01/es01.key  
- xpack.security.http.ssl.certificate\_authorities=$CERTS\_DIR/ca/ca.crt  
- xpack.security.http.ssl.certificate=$CERTS\_DIR/es01/es01.crt  
- xpack.security.transport.ssl.enabled=true  
- xpack.security.transport.ssl.verification\_mode=certificate  
- xpack.security.transport.ssl.certificate\_authorities=$CERTS\_DIR/ca/ca.crt  
- xpack.security.transport.ssl.certificate=$CERTS\_DIR/es01/es01.crt  
- xpack.security.transport.ssl.key=$CERTS\_DIR/es01/es01.key  
- XPACK\_MONITORING\_ENABLED=true  
- XPACK\_REPORTING\_ENABLED=true  
- xpack.notification.email.account:  
gmail\_account:  
profile: gmail  
smtp:  
auth: true  
starttls.enable: true  
host: '[smtp.gmail.com](http://smtp.gmail.com)'  
port: 587  
user: \*\*\*@gmail.com  
password: \*\*\*\*\*  
volumes:  
- 'certs:$CERTS\_DIR'  
- './esdata2:/usr/share/elasticsearch/data'  
ulimits:  
memlock: {soft: -1, hard: -1}

However when I run the command, docker-compose -f docker-compose.yml config  
I get the ERROR:  
ompose file './docker-compose.yml' is invalid because:  
services.es01.environment contains {"xpack.notification.email.account": {"gmail\_account": {"profile": "gmail", "smtp": {"auth": true, "starttls.enable": true, "host": "[smtp.gmail.com](http://smtp.gmail.com)", "port": 587, "user": "_ **@gmail.com", "password": "** _"}}}}, which is an invalid type, it should be a string

Any help/suggestions would be greatly appreciated

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [February 26, 2020, 3:54pm UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/2 "2020-02-26T15:54:00Z")

</div>

Hello @rmu

Which version of the Elastic stack are you running?

This is the lastest guide to setting up sending email via gmail - [https://www.elastic.co/guide/en/elasticsearch/reference/current/actions-email.html#gmail](https://www.elastic.co/guide/en/elasticsearch/reference/current/actions-email.html#gmail)

It looks like the password field should be removed and the password should be stored in the keystore.

hope that helps,  
Matt

---

<div class="post-metadata">

**Author:** ![rmu](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@rmu](https://discuss.elastic.co/u/rmu)\
**Post date:** [February 26, 2020, 4:00pm UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/3 "2020-02-26T16:00:09Z")

</div>

Hey, I am using version 7.5.1

---

<div class="post-metadata">

**Author:** ![rmu](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@rmu](https://discuss.elastic.co/u/rmu)\
**Post date:** [February 26, 2020, 4:02pm UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/4 "2020-02-26T16:02:49Z")

</div>

I removed the password, and I am stilll getting the same error as above

---

<div class="post-metadata">

**Author:** ![mattkime](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattkime/32/43522_2.png) [@mattkime](https://discuss.elastic.co/u/mattkime)\
**Post date:** [February 26, 2020, 5:10pm UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/5 "2020-02-26T17:10:38Z")

</div>

My docker compose is a bit rusty but lets try something -

Instead of passing a series of variables to `xpack.notification.email.account` instead pass each as an individual environment variable - `xpack.notification.email.account.gmail_account.profile=gmail` and `xpack.notification.email.account.gmail_account.smtp.auth=true` etc

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 25, 2020, 5:10pm UTC](https://discuss.elastic.co/t/sending-emal-from-gmail/221012/6 "2020-03-25T17:10:43Z")

</div>

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