-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendEmail.py
32 lines (27 loc) · 1022 Bytes
/
sendEmail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import requests
import config
def call_email_verify_function(email):
api_key = config.api_key
try:
response = requests.post(
"https://api.resend.com/emails",
json={
"from": "FixtureFix <[email protected]>",
"to": "[email protected]",
"subject": "New run email",
"html": f"<p>New run email</strong><strong> <br/>BED</strong>",
},
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
)
# Check if the request was successful
if response.status_code == 200:
print("Email sent successfully!")
else:
print(f"Failed to send email. Status code: {response.status_code}, Response: {response.text}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
email = "[email protected]"
call_email_verify_function( email)