[bin] Fix mail and capture scripts
This commit is contained in:
@ -10,7 +10,7 @@ import imaplib
|
|||||||
import email
|
import email
|
||||||
from email.header import decode_header
|
from email.header import decode_header
|
||||||
|
|
||||||
user = "colin@unbl.ink"
|
user = os.environ.get("MAIL_USER")
|
||||||
password = os.environ.get("MAIL_PASS")
|
password = os.environ.get("MAIL_PASS")
|
||||||
|
|
||||||
N = 15
|
N = 15
|
||||||
@ -21,6 +21,10 @@ def send_ntfy():
|
|||||||
print("Please set your password in the MAIL_PASS environment variable")
|
print("Please set your password in the MAIL_PASS environment variable")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not user:
|
||||||
|
print("Please set your user in the MAIL_USER environment variable")
|
||||||
|
return
|
||||||
|
|
||||||
conn = imaplib.IMAP4_SSL("box.unbl.ink")
|
conn = imaplib.IMAP4_SSL("box.unbl.ink")
|
||||||
conn.login(user, password)
|
conn.login(user, password)
|
||||||
|
|
||||||
|
|||||||
@ -32,11 +32,11 @@ if [ "$1" = "backyard" ]; then
|
|||||||
host="paaliaq.local"
|
host="paaliaq.local"
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "backyard_low" ]; then
|
if [ "$1" = "backyard_low" ]; then
|
||||||
port=8082
|
port=8081
|
||||||
host="paaliaq.local"
|
host="paaliaq.local"
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "basement_extension" ]; then
|
if [ "$1" = "basement_extension" ]; then
|
||||||
port=8083
|
port=8082
|
||||||
host="paaliaq.local"
|
host="paaliaq.local"
|
||||||
fi
|
fi
|
||||||
if [ "$1" = "diningroom" ]; then
|
if [ "$1" = "diningroom" ]; then
|
||||||
|
|||||||
@ -3,5 +3,6 @@ Description="Check for new email"
|
|||||||
Requires=mail-ntfy.timer
|
Requires=mail-ntfy.timer
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
EnvironmentFile=/etc/mail-ntfy.env
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=uv run /home/powellc/.bin/mail-ntfy.py
|
ExecStart=uv run /home/powellc/.bin/mail-ntfy.py
|
||||||
|
|||||||
Reference in New Issue
Block a user