Email alert not working - Grafana SMTP - tcp dial tcp [::1]:25: connectex: No connection could be made

#################################### SMTP / Emailing #####################
[smtp]
enabled = true
host = :25
user = @.com
password =""
;cert_file =
;key_file =
skip_verify = true
from_address = dineshtest2019@.com
from_name = Grafana

[emails]
welcome_email_on_sign_up = false

Here is my log for your reference:

t=2019-12-04T05:44:30-0700 lvl=info msg=“Sending alert notification to” logger=alerting.notifier.email addresses=[dineshtest2019@.com]
t=2019-12-04T05:44:32-0700 lvl=eror msg=“Failed to send alert notification email” logger=alerting.notifier.email error=“Failed to send notification to email address: dineshtest2019@.com: dial tcp [::1]:25: connectex: No connection could be made because the target machine actively refused it.”
t=2019-12-04T05:44:32-0700 lvl=eror msg=“failed to send notification” logger=alerting.notifier uid= error=“Failed to send notification to email address: dineshtest2019@.com: dial tcp [::1]:25: connectex: No connection could be made because the target machine actively refused it.”

In above, I have not provided exact domain, host and password details as am not supposed to share and hence is put under ‘<>’.

I tried without user and password as well but it doesn’t seem to be working.

I tested sending an email through PS1 script from the Grafana app server and it is working. So SMTP connection is allowed for that IP with default port# 25.

Ports 465 and 587 also tried still unable to send emails.

So, I need to understand what could be the issue and how to fix it? We can’t enable SSL/TLS for this alerting in SMTP server as doing so would impact other connections.

Please help with solution as am entering 7th day due to this issue and am in need to deploy my solution to First Prod run within few days.

Thank you.

Regards,
DinesH

The original problem is likely fixed, but anyway: this works with Gmail:

##### SMTP / Emailing #####
[smtp]
enabled = true
host = smtp.gmail.com:587
user = MY_EMAIL_ADDRESS@gmail.com
password = MY_16_CHARACTER_PASSWORD
from_address = MY_EMAIL_ADDRESS@gmail.com
from_name = GrafanaAlerts

In case you use 2FA (which everyone should), you need to get an app password which you get here: https://myaccount.google.com/security

I tried using 587 and 465 both but it is giving the above error

All I can say is that my snipped works and it likely works for all Gmail accounts. Thus if you use Gmail and it does not work, then I see those possibilities:

  • Typo somewhere (host, email address, password)
  • Password is not correct (especially if you use 2FA)
  • Your IP address range is not allowed to connect (Blocked IP address range)
  • You have a man-in-the-middle attack or generally a proxy in the middle which breaks the end-to-end encryption

no typos password is correct last 2 i am not sure

Did you check the dial tcp [::1]:25 using nc?

nc -v localhost 25

If there refusing, check the SMTP server on your localhost.

Hi @dintestgraf

I am new to grafana and faced the same issue, is your error resolved? can u help me ,how can it be resolved.

Also how should we restart grafana service if it is not present in C Drive program files?