mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 16:03:06 +01:00
27 lines
811 B
Python
Executable File
27 lines
811 B
Python
Executable File
#!/home/jas/virtualenvs/resend/bin/python
|
|
#
|
|
# Usage:
|
|
# 1. Create a virtualenv for resend under ~/virtualenvs/resend
|
|
# 2. Activate the virtualenv: `~/virtualenvs/resend/bin/activate`
|
|
# 3. Install resend API: `pip install resend`
|
|
# 4. Deactivate the virtualenv: `deactivate`
|
|
# 5. Make the script executable: `chmod +x /home/jas/bin/resend_error.py`
|
|
# 6. Run the script from another script or wherever: `/home/jas/bin/resend_error.py`
|
|
|
|
import resend
|
|
import sys
|
|
|
|
resend.api_key = "APIKEY GO HERE"
|
|
|
|
msg = sys.argv[1]
|
|
|
|
params: resend.Emails.SendParams = {
|
|
"from": "NAS <onboarding@resend.dev>",
|
|
"to": ["hyperreal@fedoraproject.org"],
|
|
"subject": "[NAS] Sync error: " + msg,
|
|
"text": "There was an error syncing data: " + msg + ". Please investigate.",
|
|
}
|
|
|
|
email = resend.Emails.send(params)
|
|
print(email)
|