Pergunta

I'm trying to write a python rogram to send email to multiple addresses.

Each time the message is the same except for the recipient's address. I thought i could just change the msg['To'] in the loop,

for email in emaillist
   ...
   msg['To'] = email
   ...
   ...

but actually each time 'email' is appended to the msg['To'].

msg.as_string() is like 'To: abc@gmail.com\nTo:xyz@gmail.com'

How can I replace the msg['To'] field rather than appending?

Thank you

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top