Skip to content
Advertisement

ValueError: There may be at most 1 To headers in a message

I am trying to write a very basic email sending script. Here is my code ..

JavaScript

the script should send mail to multiple recipients so, I need to change the msg['To'] field when iterating through loop But I get the following error in traceback bellow.

JavaScript

How do I solve ? Please help. Thank you..

Advertisement

Answer

Clean the ‘To’ property of the message.

JavaScript

Below is the code that throws the exception: (Python385Libemailmessage.py)

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement