sendmail
This commit is contained in:
parent
24b05aa210
commit
0d0391b6ee
|
|
@ -229,12 +229,9 @@ def retry_domain_emails(domain):
|
||||||
if not recipients:
|
if not recipients:
|
||||||
raise ValueError(f"Keine Empfänger in E-Mail {key} gefunden")
|
raise ValueError(f"Keine Empfänger in E-Mail {key} gefunden")
|
||||||
|
|
||||||
# An SMTP weiterleiten
|
# An SMTP weiterleiten - verwende sendmail()
|
||||||
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as smtp:
|
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as smtp:
|
||||||
smtp.mail(from_addr)
|
smtp.sendmail(from_addr, recipients, email_content)
|
||||||
for recipient in recipients:
|
|
||||||
smtp.rcpt(recipient)
|
|
||||||
smtp.data(email_content)
|
|
||||||
|
|
||||||
# Als verarbeitet markieren
|
# Als verarbeitet markieren
|
||||||
mark_email_as_processed(bucket_name, key)
|
mark_email_as_processed(bucket_name, key)
|
||||||
|
|
@ -332,12 +329,9 @@ def process_email(domain):
|
||||||
|
|
||||||
logger.info(f"[{request_id}] From: {from_addr}, Recipients: {recipients}")
|
logger.info(f"[{request_id}] From: {from_addr}, Recipients: {recipients}")
|
||||||
|
|
||||||
# An Postfix weiterleiten - für jeden Empfänger einzeln
|
# An Postfix weiterleiten - verwende sendmail() statt manueller SMTP-Befehle
|
||||||
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as smtp:
|
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as smtp:
|
||||||
smtp.mail(from_addr)
|
smtp.sendmail(from_addr, recipients, email_content)
|
||||||
for recipient in recipients:
|
|
||||||
smtp.rcpt(recipient)
|
|
||||||
smtp.data(email_content)
|
|
||||||
|
|
||||||
logger.info(f"[{request_id}] Email forwarded to Postfix for {domain} - {len(recipients)} recipients")
|
logger.info(f"[{request_id}] Email forwarded to Postfix for {domain} - {len(recipients)} recipients")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue