Spaces:
Runtime error
Runtime error
CaesarCloudSync
commited on
Commit
·
019d659
1
Parent(s):
0d8e808
Email Send Works
Browse files
main.py
CHANGED
@@ -103,6 +103,18 @@ async def revisionbankschedulerevisioncardsrepeat() -> None:
|
|
103 |
revisionbankschedule.runschedule()
|
104 |
print("All Cards sent.")
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
@app.post("/revisionbankstripepayment") # POST # allow all origins all methods.
|
107 |
async def revisionbankstripepayment(data : JSONStructure = None, authorization: str = Header(None)):
|
108 |
current_user = secure_decode(authorization.replace("Bearer ",""))["email"] # outputs the email of the user [email protected]
|
|
|
103 |
revisionbankschedule.runschedule()
|
104 |
print("All Cards sent.")
|
105 |
|
106 |
+
@app.post("/revisionbanksendemail") # POST # allow all origins all methods.
|
107 |
+
async def revisionbanksendemail(data : JSONStructure = None):
|
108 |
+
try:
|
109 |
+
data = dict(data)#request.get_json()
|
110 |
+
try:
|
111 |
+
attachment = data["attachment"]
|
112 |
+
except KeyError as kex:
|
113 |
+
attachment = None
|
114 |
+
RaspEmail.send(**{"email":data["email"],"message":data["message"],"subject":data["subject"],"attachment":attachment})
|
115 |
+
return {"message":"email has been sent."}
|
116 |
+
except Exception as ex:
|
117 |
+
return {"error":f"{type(ex)}-{ex}"}
|
118 |
@app.post("/revisionbankstripepayment") # POST # allow all origins all methods.
|
119 |
async def revisionbankstripepayment(data : JSONStructure = None, authorization: str = Header(None)):
|
120 |
current_user = secure_decode(authorization.replace("Bearer ",""))["email"] # outputs the email of the user [email protected]
|