我在CSV文件中有两封邮件。问题是,它无法登录CSV文件中的第二封邮件。
import smtplib
import email
import csv
smtp = smtplib.SMTP('smtp.gmail.com',587)
smtp.ehlo()
smtp.starttls()
m = open('msg.txt','r')
message = m.read()
with open('email.csv','r') as f:
reader = csv.DictReader(f)
for row in reader:
smtp.login(row['Addressmail'],row['Password'])
with open('listmail.csv','r') as h:
reader1 = csv.DictReader(h)
for line in reader1:
smtp.sendmail(row['Addressmail'],line['Mail'],message)