You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add Gotify Provider and CLI flags for title and priority (#9)
* feat: add gotify notification support
* fix: #8 add title and priority for gotify notification
* fix: add subject for smtp too and load default title and priority from env or config for gotify
* optimizing code structure...
---------
Co-authored-by: Asif Mohammad Mollah <admin@mrasif.in>
This guide will walk you through setting up Gotify notifications. You will learn how to obtain the necessary credentials and configure them in your environment.
4
+
5
+
## 1. Get Gotify URL and App Token
6
+
7
+
First, you need to get the Gotify server URL and an app token.
8
+
9
+
1.**Gotify Server URL**: This is the URL of your Gotify server.
10
+
2.**App Token**: You can create a new app in the Gotify web UI and get the token.
11
+
12
+
## 2. Configure Chatz
13
+
14
+
Next, you need to configure Chatz to use the Gotify provider. You can do this by editing the `~/.chatz.ini` file or by setting environment variables.
15
+
16
+
### Using `~/.chatz.ini`
17
+
18
+
Add the following section to your `~/.chatz.ini` file:
19
+
20
+
```ini
21
+
[gotify]
22
+
PROVIDER=gotify
23
+
GOTIFY_URL=<your-gotify-server-url>
24
+
GOTIFY_TOKEN=<your-gotify-app-token>
25
+
GOTIFY_TITLE=<your-gotify-title>
26
+
GOTIFY_PRIORITY=<your-gotify-priority>
27
+
```
28
+
29
+
### Using Environment Variables
30
+
31
+
Set the following environment variables:
32
+
33
+
```sh
34
+
export PROVIDER=gotify
35
+
export GOTIFY_URL=<your-gotify-server-url>
36
+
export GOTIFY_TOKEN=<your-gotify-app-token>
37
+
export GOTIFY_TITLE=<your-gotify-title>
38
+
export GOTIFY_PRIORITY=<your-gotify-priority>
39
+
```
40
+
41
+
## 3. Send a Test Notification
42
+
43
+
Now you can send a test notification to your Gotify server.
44
+
45
+
```sh
46
+
chatz --profile=gotify "Hello from Chatz!"
47
+
```
48
+
49
+
You should receive a notification on your Gotify server.
50
+
51
+
### Using CLI Flags
52
+
53
+
You can also override the title and priority using CLI flags:
54
+
55
+
```sh
56
+
chatz --profile=gotify --subject "Custom Title" --priority 7 "Hello from Chatz!"
57
+
```
58
+
59
+
This will send a notification with "Custom Title" as the title and a priority of 7.
Copy file name to clipboardExpand all lines: docs/smtp.md
+29-24Lines changed: 29 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,41 +2,34 @@
2
2
3
3
This document explains how to configure SMTP with Gmail, including creating an App Password, and understanding TLS/STARTTLS and encryption options.
4
4
5
-
6
5
## 1. Creating an App Password
7
6
8
-
Gmail requires an "App Password" for less secure apps accessing your account. This is a more secure alternative to using your regular Gmail password directly.
7
+
Gmail requires an "App Password" for less secure apps accessing your account. This is a more secure alternative to using your regular Gmail password directly.
9
8
10
9
1. Go to your [Google account security settings](https://myaccount.google.com/security).
11
10
2. Scroll down to "Signing in to Google" and click "App Passwords".
12
-
3. Select "Mail" as the app and "Other (Custom name)" as the device. Give it a descriptive name (e.g., "My SMTP App").
13
-
4. Click "Generate". A new password will be displayed. **Copy this password immediately; you won't be able to see it again.**
11
+
3. Select "Mail" as the app and "Other (Custom name)" as the device. Give it a descriptive name (e.g., "My SMTP App").
12
+
4. Click "Generate". A new password will be displayed. **Copy this password immediately; you won't be able to see it again.**
14
13
15
14
## 2. SMTP Server Settings
16
15
17
-
***Server:**`smtp.gmail.com`
18
-
***Port:**
19
-
***STARTTLS:** 587 (Recommended)
20
-
***TLS:** 465
21
-
***No Encryption (Insecure - Avoid):** 25
22
-
***Username:** Your full Gmail address (e.g., `yourname@gmail.com`)
23
-
***Password:** The App Password you generated.
24
-
16
+
-**Server:**`smtp.gmail.com`
17
+
-**Port:**
18
+
-**STARTTLS:** 587 (Recommended)
19
+
-**TLS:** 465
20
+
-**No Encryption (Insecure - Avoid):** 25
21
+
-**Username:** Your full Gmail address (e.g., `yourname@gmail.com`)
22
+
-**Password:** The App Password you generated.
25
23
26
24
## 3. TLS/STARTTLS and Encryption
27
25
28
-
***TLS (Transport Layer Security) / STARTTLS:** These are encryption protocols that secure the connection between your email client and the SMTP server. They encrypt your email messages and prevent eavesdropping. **Using TLS/STARTTLS is strongly recommended.** Many email clients support STARTTLS, initiating encryption during the connection process.
29
-
30
-
31
-
***No Encryption:** Sending emails without encryption is highly discouraged. Your email, including the subject, body, and any attachments, could be intercepted by malicious actors. Avoid this unless absolutely necessary, and only with trusted parties.
32
-
26
+
-**TLS (Transport Layer Security) / STARTTLS:** These are encryption protocols that secure the connection between your email client and the SMTP server. They encrypt your email messages and prevent eavesdropping. **Using TLS/STARTTLS is strongly recommended.** Many email clients support STARTTLS, initiating encryption during the connection process.
33
27
28
+
-**No Encryption:** Sending emails without encryption is highly discouraged. Your email, including the subject, body, and any attachments, could be intercepted by malicious actors. Avoid this unless absolutely necessary, and only with trusted parties.
34
29
35
30
## 4. Example Configuration (Illustrative - adapt to your email client)
36
31
37
-
38
-
This is a generic example; the exact settings will depend on your email client (e.g., Outlook, Thunderbird). Refer to your email client's documentation for specific instructions.
39
-
32
+
This is a generic example; the exact settings will depend on your email client (e.g., Outlook, Thunderbird). Refer to your email client's documentation for specific instructions.
40
33
41
34
```
42
35
SMTP_HOST=smtp.gmail.com
@@ -46,14 +39,26 @@ SMTP_USE_STARTTLS=true
46
39
47
40
Remember to replace placeholders with your actual information.
48
41
49
-
##5. Troubleshooting
42
+
### Using CLI Flags
50
43
44
+
You can also override the subject using the CLI flag:
45
+
46
+
```sh
47
+
chatz --profile=smtp --subject "Custom Subject""Hello from Chatz!"
48
+
```
49
+
50
+
This will send an email with "Custom Subject" as the subject.
51
+
52
+
## 5. Troubleshooting
51
53
52
54
If you encounter issues, check:
53
55
54
-
***Correct App Password:** Verify you copied the correct App Password.
55
-
***Firewall Settings:** Ensure your firewall isn't blocking outgoing connections on port 587 (or 465 if using no encryption).
56
-
***Email Client Configuration:** Double-check all server settings in your email client.
56
+
-**Correct App Password:** Verify you copied the correct App Password.
57
+
-**Firewall Settings:** Ensure your firewall isn't blocking outgoing connections on port 587 (or 465 if using no encryption).
58
+
-**Email Client Configuration:** Double-check all server settings in your email client.
57
59
58
60
Using an App Password is crucial for securing your Gmail account when using SMTP. Always prioritize using TLS/STARTTLS encryption for the security of your emails.
0 commit comments