首页 > 解决方案 > 如何解决 '530 5.7.0 必须先发出 STARTTLS 命令。o63-v6sm4041934ywc.36 - 用于弹性搜索的 gsmtp\n'?

问题描述

我正在创建一个需要为我的日志发送电子邮件警报的应用程序。这是创建观察者的输入:

PUT _xpack/watcher/watch/log_error_watch
{
  "trigger" : {
    "schedule" : { "interval" : "10s" } 
  },
  "input" : {
    "search" : {
      "request" : {
        "indices" : [ "testindexv4" ],
        "body" : {
          "query" : {
            "match" : { "log_level": "ERROR" }
          }
        }
      }
    }
  }
  ,
  "actions" : {
  "send_email" : { 
    "email" : { 
      "to" : "<mailId>@gmail.com", 
      "subject" : "Watcher Notification", 
      "body" : "error logs found" 
    }
  }
}
}

这是 elasticsearch.yml 的配置

xpack.security.enabled: false
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: false
             starttls.enable: false
             starttls.required: false
             host: smtp.gmail.com
             port: 587

当我尝试运行我的观察者时,我收到以下错误:

reason": "530 5.7.0 Must issue a STARTTLS command first. o63-v6sm4041934ywc.36 - gsmtp\n

请问有什么解决方案吗?

标签: elasticsearchelasticsearch-x-pack

解决方案


现在解决了,我需要做的就是启用 TLS 身份验证。

这是我的elasticsearch.yml更新内容:

xpack.security.enabled: false 
xpack.notification.email.account:
      standard_account:
         profile: standard
         smtp:
             auth: true
             starttls.enable: true
             starttls.required: true
             host: smtp.gmail.com
             port: 587
             user: <mailId>
             password: <passowrd>

推荐阅读