import pandas as pd
df=pd.read_csv(r"C:\Users\Home\Downloads\apple_products2.csv", usecols=['ID','msg','sub'],low_memory=True)
df=pd.DataFrame(df)
import smtplib
from email.mime.text import MIMEText
subject = "Test Email Subject"
sender = "sk9775589@gmail.com"
#recipients = ["sabhajeetkumar1@gmail.com"]
password = "qwsnxvnheoqyauij"
def send_email(subject, body, sender, recipients, password):
msg = MIMEText(body)
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = ', '.join(recipients)
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp_server:
smtp_server.login(sender, password)
smtp_server.sendmail(sender, recipients, msg.as_string())
print("Message sent!")
for x in range(len(df)):
send_email(df.loc[x,'sub'], df.loc[x,'msg'], sender, df.loc[x,'ID'], password)
Comments
Post a Comment