fix(chalice): fixed send multi-recipient email (#2302)

close #2299
This commit is contained in:
Kraiem Taha Yassine 2024-06-24 18:49:42 +02:00 committed by GitHub
parent d771ce8088
commit 7cfaa0a49b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,10 +56,10 @@ def send_html(BODY_HTML, SUBJECT, recipient):
msg.attach(body)
for m in mime_img:
msg.attach(m)
msg["To"] = ''
with smtp.SMTPClient() as s:
for r in recipient:
msg["To"] = r
msg.replace_header('To', r)
try:
logging.info(f"Email sending to: {r}")
s.send_message(msg)