I am trying to send letters from python to several email addresses imported from a TXT file, I tried different syntaxes, but nothing worked ...
The code:
s.sendmail('sender@mail.com', ['recipient@mail.com', 'recipient2@mail.com', 'recipient3@mail.com'], msg.as_string())
So, I tried this to import recipient addresses from a .txt file:
urlFile = open("mailList.txt", "r+")
mailList = urlFile.read()
s.sendmail('sender@mail.com', mailList, msg.as_string())
The mainList.txt file contains:
['recipient@mail.com', 'recipient2@mail.com', 'recipient3@mail.com']
But this does not work ...
I also tried:
... [mailList] ... in the code, and '...','...','...' in the .txt file, but also no effect
and
... [mailList] ... in the code, and ...','...','... in the .txt file, but also no effect...
Does anyone know what to do?
Thank you so much!