(20250122) Mail module adjustment for sending mails from whitelisted IPs.
This commit is contained in:
@@ -344,6 +344,9 @@ async def send_reminders_by_chat(chat_df: pd.DataFrame) -> None:
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Start with blank variables:
|
||||
log_id = None
|
||||
|
||||
# Get a list of unique token-keys:
|
||||
unique_token_keys = chat_df["tokenKey"].unique().tolist()
|
||||
|
||||
@@ -373,6 +376,9 @@ async def send_reminders_by_chat(chat_df: pd.DataFrame) -> None:
|
||||
}
|
||||
)
|
||||
|
||||
# Get the log id from the response:
|
||||
log_id = response.json()["logId"]
|
||||
|
||||
# If the API call failed:
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -384,7 +390,7 @@ async def send_reminders_by_chat(chat_df: pd.DataFrame) -> None:
|
||||
# Send out an alert if needed:
|
||||
if exception is not None:
|
||||
await send_telegram(
|
||||
message = f"*Reminders For Work (Chat)*\n\nException: `{exception}`",
|
||||
message = f"*Reminders For Work (Chat)*\n\nException: `{exception}`\n\nLog Id: `{log_id}`",
|
||||
message_type = "error"
|
||||
)
|
||||
|
||||
@@ -400,6 +406,9 @@ async def send_reminders_by_mail(mail_df: pd.DataFrame) -> None:
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Start with blank variables:
|
||||
log_id = None
|
||||
|
||||
# Iterate over all the rows and send out the mails:
|
||||
for index, row in mail_df.iterrows():
|
||||
|
||||
@@ -428,6 +437,9 @@ async def send_reminders_by_mail(mail_df: pd.DataFrame) -> None:
|
||||
json = input_json
|
||||
)
|
||||
|
||||
# Get the log id from the response:
|
||||
log_id = response.json()["logId"]
|
||||
|
||||
# If the API call failed:
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -439,7 +451,7 @@ async def send_reminders_by_mail(mail_df: pd.DataFrame) -> None:
|
||||
# Send out an alert if needed:
|
||||
if exception is not None:
|
||||
await send_telegram(
|
||||
message = f"*Reminders For Work (Mail)*\n\nException: `{exception}`",
|
||||
message = f"*Reminders For Work (Mail)*\n\nException: `{exception}`\n\nLog Id: `{log_id}`",
|
||||
message_type = "error"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user