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

How to resolve ‘530 5.7.0 Must issue a STARTTLS command first. o63-v6sm4041934ywc.36 - gsmtp\n’ for elasticsearch?

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

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

有相同的解决方案吗?

现在已经解决了,我只需要开启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>