Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在回复中添加电子邮件列表_Python_Email_Smtp_Smtplib - Fatal编程技术网

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

Python 如何在回复中添加电子邮件列表,python,email,smtp,smtplib,Python,Email,Smtp,Smtplib,我想发送一封邮件,邮件标题为“回复”我传递了一个列表 replyto=['email1@gmal.com','email2@gmail.com'] 添加到addheader方法中。这是我的密码 message = MIMEMultipart("alternative") message['to'] = ",".join(to) message['from'] = sender message['subject'] = subject message.add_header('In-Reply-T

我想发送一封邮件,邮件标题为“回复”我传递了一个列表

replyto=['email1@gmal.com','email2@gmail.com']
添加到addheader方法中。这是我的密码

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

因此,通过这个错误,我知道我不可能传递电子邮件列表。如何将邮件标题中的电子邮件列表传递给?是否有其他方法完成此工作?

将列表转换为字符串:

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

用逗号连接更有意义<代码>str1=','。加入(replyto)@user2883215放置逗号!另一方面,它正在发挥作用thanks@AayushMahajan伊哈!