mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2025-01-18 15:53:45 +01:00
35 lines
655 B
Python
35 lines
655 B
Python
|
# /// script
|
||
|
# dependencies = [
|
||
|
# "resend",
|
||
|
# ]
|
||
|
# ///
|
||
|
|
||
|
import subprocess
|
||
|
import sys
|
||
|
from pathlib import Path
|
||
|
|
||
|
import resend
|
||
|
|
||
|
|
||
|
def main():
|
||
|
resend.api_key = Path("/usr/local/etc/resend_api_key.txt").read_text().strip("\n")
|
||
|
|
||
|
if len(sys.argv) != 3:
|
||
|
exit("Usage: resend_notify.py SUBJECT MESSAGE")
|
||
|
subject = sys.argv[1]
|
||
|
message = sys.argv[2]
|
||
|
|
||
|
params: resend.Emails.SendParams = {
|
||
|
"from": "Admin <admin@hyperreal.coffee>",
|
||
|
"to": ["hyperreal@moonshadow.dev"],
|
||
|
"subject": subject,
|
||
|
"text": message,
|
||
|
}
|
||
|
|
||
|
email = resend.Emails.send(params)
|
||
|
print(email)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|