Skip to content

[Documentation] Information for setting up email alertsΒ #343

@user-566

Description

@user-566

Introduction

I installed recently the app but I couldn't figure out how to set up email alerts (which was the main reason I wanted to use it), and I didn't find any documentation in the FAQ/README. I eventually figured it out, so I thought I'd make this post for anyone else having trouble.

What I did

During the initial setup, I did get prompted to know if I wanted to enable email alerts, and to configure SMTP, which I of course did (didn't take any pictures because I didn't think it would be necessary, sorry). However after completing the installation and while I was still getting familiar with the interface, it was clear from the testing I was doing something was not working right.

Finally my doubts were confirmed when I visited the settings page of the web GUI:
image

Since I couldn't find any options in the web GUI to configure email alerts, I dug a little deeper. I eventually found the ~/pialert/config/pialert.conf file, which I opened using nano to find the following:
image

Like I said I'm about 99% percent sure I did chose to enable email alerts during initial setup, but nevertheless I edited both fields to "True" and saved the document, and now "Mail" showed up as green in the notifications in the settings page of the web GUI:
image

With that out of the way, I wanted to test if the email alerts actually worked, but again was having trouble finding documentation on the subject. I did find the "Test Notification" button in the settings fairly quickly, and while it did give me a notification in the web GUI, I got no email and nothing indicated wether or not it even tried sending one.
image

I eventually found issue #105, and this comment that indicated there was a command I could execute to send a test email notification. I navigated to the "~/pialert/back" folder and executed the "./pialert-cli reporting_test" as indicated and got the following error (redacted some numbers for privacy as I didn't know what they were):
image

Thankfully, I knew exactly what the problem was as I had gone through the same thing with my UPS email alerts recently. As indicated on the Google support page linked in the error, I simply needed to use an app password instead of putting the password to my gmail account like I had done.

For those unaware, Google made a change in 2021 which broke a lot of apps that used your gmail account credentials to send emails. Fortunately the fix is fairly simple, first of all you need to enable 2 factor authentication on your Google Account. This is a requirement as the following steps will not work if it is not enabled (don't ask me how I know). After that just go to your Google account settings and search for "app passwords":

image

Create an app password for Pi-Alert and copy it to the "pialert.conf" file:
image

Now executing the "./pialert-cli reporting_test" I do finally get an email alert:
image

Also tested by enabling the "alert down" option on one of my devices and disconnecting it from the network, and likewise email notifications worked! If they don't for you, make sure you have this option enabled in the settings of the web GUI:

image

Conclusion

I'm sorry if this well known information or if it's already documented somewhere, the goal of this post was simply to save someone like me a bit of time in the future if they ran into the same troubles as I did. Please let me know if anything is not clear or doesn't work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions