如何在回复中添加电子邮件列表

How to add List of emails in the reply to

我要发邮件 header reply-to 我通过了一个列表

replyto=['email1@gmal.com','email2@gmail.com']

进入添加header方法。这是我的代码。

message = MIMEMultipart("alternative")
message['to'] = ",".join(to)
message['from'] = sender
message['subject'] = subject
message.add_header('In-Reply-To', replyto)

我收到的错误是

TypeError: sequence item 0: expected str instance, list found

所以通过错误,我知道我不可能传递电子邮件列表。如何在 header reply-to 中传递电子邮件列表?还有其他方法可以完成这项工作吗?

将列表转换为字符串:

str1 = ','.join(replyto)
message.add_header('In-Reply-To', str1)