Open ShaneC-C-Y opened 8 years ago
You must use an SMTP server to send email. There is a setting smtp_host
which you need to set. It's trying to default localhost but no server is listening there.
Thank for your help, sorry I am not familiar how to use SMTP server. This is my setting:
# (required, email specific)
# a list of email addresses to send alerts to
email:
#- "elastalert@example.com"
- "chienyuc@elementaltechnologies.com"
smtp_host: "smtp.gmail.com"
smtp_port: 587
smtp:ssl: true
from_addr: "chienyuc@elementaltechnologies.com"
smtp_auth_file: '/opt/elastalert/smtp_auth_file.yaml'
and the smtp_auth_file.yaml
is
---
user: ---my-full-email---
password: ---my-email-login-password
...
but it still doesn't work
You have a typo. smtp_ssl: true
instead of smtp:ssl: true
. Also, try port 465 is for SSL gmail smtp, 587 is for TLS (STARTTLS, which elastalert does support too, but then you don't want smtp_ssl set)
hi Quentin Long, thank you very much. Now I can receive the email. My setting is the following:
email:
#- "elastalert@example.com"
- "chienyuc@elementaltechnologies.com"
smtp_host: "smtp.gmail.com"
smtp_port: 465
smtp_ssl: true
from_addr: "chienyuc@elementaltechnologies.com"
smtp_auth_file: '/opt/elastalert/smtp_auth_file.yaml'
if I keep port 587, the error message is like this:
ERROR:root:Error while running alert email: Error connecting to SMTP host: [Errno 1] _ssl.c:510: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
BTW, I received this error message if I didn't create I new password
ERROR:root:Error while running alert email: Error connecting to SMTP host: (534, '5.7.9 Application-specific password required. Learn more at\n5.7.9 https://support.google.com/accounts/answer/185833 i187sm5150287pfc.62 - gsmtp')
So we need to create another password to use, steps are here: (https://support.google.com/accounts/answer/185833)
Hope it can help others, thank you again!
hi Quentin Long, thank you very much. Now I can receive the email. My setting is the following:
email: #- "elastalert@example.com" - "chienyuc@elementaltechnologies.com" smtp_host: "smtp.gmail.com" smtp_port: 465 smtp_ssl: true from_addr: "chienyuc@elementaltechnologies.com" smtp_auth_file: '/opt/elastalert/smtp_auth_file.yaml'
if I keep port 587, the error message is like this:
ERROR:root:Error while running alert email: Error connecting to SMTP host: [Errno 1] _ssl.c:510: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
BTW, I received this error message if I didn't create I new password
ERROR:root:Error while running alert email: Error connecting to SMTP host: (534, '5.7.9 Application-specific password required. Learn more at\n5.7.9 https://support.google.com/accounts/answer/185833 i187sm5150287pfc.62 - gsmtp')
So we need to create another password to use, steps are here: (https://support.google.com/accounts/answer/185833)
Hope it can help others, thank you again!
hello, can you please show me the exact content of you "smtp_auth_file.yaml" file ? my setting is as same as your's but the error still exist (errno 111 connection refused) and i am using orginazation's internal mail server... thanks
This issue may be due to this not being merged Add parameter 'smtp_ca_file', fix STARTTLS problem #2681
Launch a web browser on the terminal running ElastAlert, access the Google settings screen, go to the Google account → App that can access the account → Allow less secure apps: Disable → Change to enable. When I specified the Gmail address with from_addr and confirmed the operation, it worked normally.
smtp_port: 587
smtp_host: "smtp.gmail.com"
smtp_port: 587
smtp_ssl: false
smtp_auth_file: '/opt/elastalert/smtp/smtp_auth_user.yaml"
smtp_auth_user.yaml
user: xxx@gmail
password: xxx
smtp_port: 465
smtp_host: "smtp.gmail.com"
smtp_port: 465
smtp_ssl: true
smtp_auth_file: '/opt/elastalert/smtp/smtp_auth_user.yaml"
smtp_auth_user.yaml
user: xxx@gmail
password: xxx
You have a typo.
smtp_ssl: true
instead ofsmtp:ssl: true
. Also, try port 465 is for SSL gmail smtp, 587 is for TLS (STARTTLS, which elastalert does support too, but then you don't want smtp_ssl set)
it works for ,just set smtp_ssl: true
Hi everyone, I have finished
elastalert-create-index
and got the status created. But when I started to add log into elasticsearch, elastalert can't send out email to alert me.I have checked the previous post (https://github.com/Yelp/elastalert/issues/256) and set my
example_rules/example_frequency.yaml
file as following