# Update #15 - Using Gmail App Password to Get Alerts!

#### **Date:** May 22nd, 2025  
**Category:** Security / Automation  
**Backlink:** [Update #14 – Auto-Banning Fail2Ban IPs Based on AbuseIPDB Reputation](https://docs.natenetworks.com/books/02-project-notes/page/update-14-auto-banning-fail2ban-ips-based-on-abuseipdb-reputation)

---

I made a new Gmail account for alerts on my VPS.

I created a new app password:

[![2025-05-22 17_17_11-App passwords — Mozilla Firefox.png](https://docs.natenetworks.com/uploads/images/gallery/2025-05/scaled-1680-/b48cwIYzHBKBsIEW-2025-05-22-17-17-11-app-passwords-mozilla-firefox.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-05/b48cwIYzHBKBsIEW-2025-05-22-17-17-11-app-passwords-mozilla-firefox.png)

I installed a mail alert system via msmtp (Lightweight SMTP Relay Client) with Gmail Support:

```bash
sudo apt update
sudo apt install msmtp msmtp-mta -y
```

I hit no on this screen here:  
[![2025-05-22 17_18_20-App passwords — Mozilla Firefox.png](https://docs.natenetworks.com/uploads/images/gallery/2025-05/scaled-1680-/jFfaySsP7F7tPX2x-2025-05-22-17-18-20-app-passwords-mozilla-firefox.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-05/jFfaySsP7F7tPX2x-2025-05-22-17-18-20-app-passwords-mozilla-firefox.png)

I made a hidden file using this command:

```bash
sudo nano ~/.msmtprc
```

I filled in my email and app password within the file:

[![2025-05-22 17_23_26-App passwords — Mozilla Firefox.png](https://docs.natenetworks.com/uploads/images/gallery/2025-05/scaled-1680-/3qSBvJgDibgFdmlY-2025-05-22-17-23-26-app-passwords-mozilla-firefox.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-05/3qSBvJgDibgFdmlY-2025-05-22-17-23-26-app-passwords-mozilla-firefox.png)

I secured the file using:

```bash
sudo chmod 600 ~/.msmtprc
```

The 600 meaning:  
6 = read (4) + write (2) = read/write for the owner  
0 = no permission for group  
0 = no permission for others  
  
I tested the file by echoing myself an email:

```bash
echo "Success! Email is working." | msmtp -v <your.email@here.com>
```

If you have the app password set up and followed along you will get a email. It should say success on the bottom after running the command:

[![image.png](https://docs.natenetworks.com/uploads/images/gallery/2025-05/scaled-1680-/yso7ac8UcOwOowXP-image.png)](https://docs.natenetworks.com/uploads/images/gallery/2025-05/yso7ac8UcOwOowXP-image.png)

You can now use this to set up alerts for all different kinds of thing which I will do.