import smtplib
from itertools import cycle
def read_file(file_path):
with open(file_path, 'r') as file:
return [[Link]() for line in file]
def send_email(smtp_info, sender, recipient, subject, body):
try:
server = [Link](smtp_info['host'], smtp_info['port'])
[Link]()
[Link](smtp_info['username'], smtp_info['password'])
message = f"From: {sender}\nTo: {recipient}\nSubject: {subject}\n\n{body}"
[Link](sender, recipient, message)
[Link]()
print(f"Email sent to {recipient} using {smtp_info['host']}")
except Exception as e:
print(f"Failed to send email to {recipient}: {e}")
def main():
emails = read_file('[Link]')
smtp_servers = read_file('[Link]')
smtp_info_list = [{'host': [Link]()[0], 'port': int([Link]()[1]),
'username': [Link]()[2], 'password': [Link]()[3]} for smtp in smtp_servers]
smtp_cycle = cycle(smtp_info_list)
sender = 'your_email@[Link]'
subject = 'Your Subject Here'
body = 'Your Email Body Here'
for email in emails:
smtp_info = next(smtp_cycle)
send_email(smtp_info, sender, email, subject, body)
if __name__ == "__main__":
main()