Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJC committed Nov 2, 2023
1 parent 8dad6f6 commit af3012d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lambda/email-forwarder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
allowed_send_as_emails = [x.lower().strip() for x in _asam.split(",") if "@" in x]


def get_forward_mappings(email: str):
def get_forward_mappings(email: str) -> dict:
for fm in forward_mapping:
if email.startswith(f"{fm}@"):
return forward_mapping[fm]
Expand Down Expand Up @@ -338,19 +338,19 @@ def lambda_handler(event, context):
r.lower() for r in event["Records"][0]["ses"]["receipt"]["recipients"]
]
for dest in destinations:
for mapped_email in get_forward_mappings(dest):
if mapped_email:
# Create the message.
message = create_message(
file_dict,
mapped_email["system_email"],
mapped_email["reply_from"],
)
if message:
print(message)
# Send the email and print the result.
result = send_email(message)
print(result)
mapped_email = get_forward_mappings(dest)
if mapped_email:
# Create the message.
message = create_message(
file_dict,
mapped_email["system_email"],
mapped_email["reply_from"],
)
if message:
print(message)
# Send the email and print the result.
result = send_email(message)
print(result)

tag_proc_resp = client_s3.put_object_tagging(
Bucket=incoming_email_bucket,
Expand Down

0 comments on commit af3012d

Please sign in to comment.