# Elasticsearch gmail config works in windows fails in MAC

**URL:** <https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [April 7, 2019, 9:01pm UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737 "2019-04-07T21:01:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![vkank](https://avatars.discourse-cdn.com/v4/letter/v/43a26b/32.png) [@vkank](https://discuss.elastic.co/u/vkank)\
**Post date:** [April 7, 2019, 9:01pm UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/1 "2019-04-07T21:01:59Z")

</div>

I am new to ElasticSearch. My email configurations are working in Windows but same config fails on MAC (Or Ubuntu).

My ElasticSearch.yml:

```auto
xpack.license.self_generated.type: basic
xpack.security.enabled: false
xpack.notification.email.account:
    gmail_account:
        profile: gmail
        smtp:
            auth: true
            starttls.enable: true
            host: smtp.gmail.com
            port: 587
            user: <USER_NAME>@gmail.com

```

Following documentations from : [https://www.elastic.co/guide/en/elastic-stack-overview/current/actions-email.html#configuring-email](https://www.elastic.co/guide/en/elastic-stack-overview/current/actions-email.html#configuring-email)

There is no firewall on my MAC. I welcome any suggestions.

Error logs:

[2019-04-07T13:37:17,019][ERROR][o.e.x.w.a.e.ExecutableEmailAction] [Cvja-AM] failed to execute action [_inlined_ /email\_1] javax.mail.MessagingException: failed to send email with subject [Test] via account [gmail\_account] at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:154) ~[?:?] at org.elasticsearch.xpack.watcher.notification.email.EmailService.send(EmailService.java:146) ~[?:?] at org.elasticsearch.xpack.watcher.actions.email.ExecutableEmailAction.execute(ExecutableEmailAction.java:72) ~[?:?] at org.elasticsearch.xpack.core.watcher.actions.ActionWrapper.execute(ActionWrapper.java:144) [x-pack-core-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService.executeInner(ExecutionService.java:456) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:295) [x-pack-watcher-6.7.0.jar:6.7.0] at org.elasticsearch.xpack.watcher.transport.actions.execute.TransportExecuteWatchAction$1.doRun(TransportExecuteWatchAction.java:164)

...

Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: [smtp.gmail.com](http://smtp.gmail.com), 587; timeout 120000 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209) ~[?:?] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740) ~[?:?] at javax.mail.Service.connect(Service.java:366) ~[?:?]

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 8, 2019, 3:56am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/2 "2019-04-08T03:56:36Z")

</div>

The error message seems to indicate that your server can not access the smtp server.  
I'd suspect a firewall problem...

---

<div class="post-metadata">

**Author:** ![vkank](https://avatars.discourse-cdn.com/v4/letter/v/43a26b/32.png) [@vkank](https://discuss.elastic.co/u/vkank)\
**Post date:** [April 8, 2019, 4:34am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/3 "2019-04-08T04:34:14Z")

</div>

There are a few things that I tried :

1. I can access SMTP server using the telnet on my MAC ([smtp.gmail.com](http://smtp.gmail.com)). I can access it on port 465, meaning that SSL is used.  
However I was not able to find the relevant config for elastic.yml for the port 465.

2. I was not able to get the elastic config working for neither 587 or 465 ports on Ubuntu. The same works from my windows machine but fails from Linux or Mac. There is no firewall on MAC.

Is there a way I can identify the SMTP server issue ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 8, 2019, 5:43am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/4 "2019-04-08T05:43:11Z")

</div>

I dunno. @spinscale do you know?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [April 9, 2019, 9:00am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/5 "2019-04-09T09:00:33Z")

</div>

The `couldnt connect` error message usually indicates a network issue/firewall. On your mac you might have tools running like little snitch that do this?

What error do you get when running `telnet smtp.gmail.com 587`? If that one does not work, then there is indeed a component on your MAC running blocking this.

The exception above indicates, that after 2 minutes no connection could be established. One more thing: Can you restart elasticsearch on your mac and retry? This way, the JVM DNS cache is cleared.

---

<div class="post-metadata">

**Author:** ![vkank](https://avatars.discourse-cdn.com/v4/letter/v/43a26b/32.png) [@vkank](https://discuss.elastic.co/u/vkank)\
**Post date:** [April 9, 2019, 7:30pm UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/6 "2019-04-09T19:30:38Z")

</div>

On my Mac: telnet [smtp.gmail.com](http://smtp.gmail.com) 587:

Trying 74.125.142.109...  
telnet: connect to address 74.125.142.109: Operation timed out  
Trying 2607:f8b0:400e:c00::6d...  
telnet: connect to address 2607:f8b0:400e:c00::6d: No route to host  
telnet: Unable to connect to remote host

On Ubuntu machine:  
Trying 74.125.20.108...  
Trying 2607:f8b0:400e:c00::6d...  
telnet: Unable to connect to remote host: Network is unreachable

I have tried restarting the elasticsearch multiple times.

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [April 10, 2019, 6:33am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/7 "2019-04-10T06:33:19Z")

</div>

you will need to resolve the network issue between your mac and gmail before progressing with this further.

when you get something like:

```auto
$> telnet smtp.gmail.com 587
Trying 173.194.76.109...
Connected to gmail-smtp-msa.l.google.com.
Escape character is '^]'.
220 smtp.gmail.com ESMTP q4sm48571442wrx.25 - gsmtp

```

you can try again with ES.

---

<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:** [May 8, 2019, 6:33am UTC](https://discuss.elastic.co/t/elasticsearch-gmail-config-works-in-windows-fails-in-mac/175737/8 "2019-05-08T06:33:20Z")

</div>

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