This commit is contained in:
Andreas Knuth 2025-12-17 13:44:37 -06:00
parent c2288d22dc
commit e756c5f91d
1 changed files with 9 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import signal
from email.parser import BytesParser from email.parser import BytesParser
from email.policy import SMTP as SMTPPolicy from email.policy import SMTP as SMTPPolicy
from datetime import datetime from datetime import datetime
from botocore.exceptions import ClientError # Neu: Korrekter Import für SES-Exceptions
# AWS Configuration # AWS Configuration
AWS_REGION = 'us-east-2' AWS_REGION = 'us-east-2'
@ -566,13 +567,16 @@ def process_message(message_body: dict, receive_count: int) -> bool:
) )
log(f"✓ Forwarded to {forward_to} from {recipient} (original: {original_from})") log(f"✓ Forwarded to {forward_to} from {recipient} (original: {original_from})")
except boto3.exceptions.ClientError as e: except ClientError as e: # Fix: Korrekter Exception-Typ
if 'MessageRejected' in str(e): error_code = e.response['Error']['Code']
log(f"⚠ SES rejected: {e}. Check verification.", 'ERROR') if error_code == 'MessageRejected':
log(f"⚠ SES rejected send for {recipient}: {e}. Check verification or quotas.", 'ERROR')
elif error_code == 'AccessDenied':
log(f"⚠ SES AccessDenied for {recipient}: {e}. Check IAM policy.", 'ERROR')
else: else:
log(f"⚠ Rules error for {recipient}: {e}", 'WARNING') log(f"SES error for {recipient}: {e}", 'ERROR')
except Exception as e: except Exception as e:
log(f"⚠ General error: {e}", 'WARNING') log(f"⚠ General error for {recipient}: {e}", 'WARNING')
# 6. SMTP VERSAND (Loop über Recipients) # 6. SMTP VERSAND (Loop über Recipients)
log(f"📤 Sending to {len(recipients)} recipient(s)...") log(f"📤 Sending to {len(recipients)} recipient(s)...")