Help with log configuration

I'm trying to configure to elastic send an email with log error, but without success

i trying this:

  smtp:
type: SMTPAppender
BufferSize: "2" 
SMTPHost: smtp.gmail.com
SMTPPort: "465"
SMTPProtocol: smtps
SMTPUsername: user
SMTPPassword: pas
From: user
To: fabioebner@gmail.com
Subject: "Log de Parna por exemplo"
layout:
  type: pattern
  conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

can samone help me?

tks

I'm not really following, how are you trying to send this from ES?

Yes. i wanna to every erro in ES send the log to my email,

You might want to use Logstash to do this instead.