我尝试从 Python 向多个电子邮件地址发送电子邮件,这些地址是从一个 .txt 文件中导入的。我尝试了不同的语法,但没有一种能够成功...
代码如下:
所以我尝试从一个 .txt 文件中导入收件人地址:
主列表文件 mainList.txt 包含:
但它不起作用...
我也试过做:
有人知道该怎么做吗?
非常感谢!
代码如下:
s.sendmail('sender@mail.com', ['recipient@mail.com', 'recipient2@mail.com', 'recipient3@mail.com'], msg.as_string())
所以我尝试从一个 .txt 文件中导入收件人地址:
urlFile = open("mailList.txt", "r+")
mailList = urlFile.read()
s.sendmail('sender@mail.com', mailList, msg.as_string())
主列表文件 mainList.txt 包含:
['recipient@mail.com', 'recipient2@mail.com', 'recipient3@mail.com']
但它不起作用...
我也试过做:
... [mailList] ... in the code, and '...','...','...' in the .txt file, but also no effect
并且
... [mailList] ... in the code, and ...','...','... in the .txt file, but also no effect...
有人知道该怎么做吗?
非常感谢!