Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import smtplib
|
3 |
+
from email.mime.multipart import MIMEMultipart
|
4 |
+
from email.mime.text import MIMEText
|
5 |
+
|
6 |
+
|
7 |
+
from_addr='ENTER_SENDERS_MAILID'
|
8 |
+
|
9 |
+
data=pd.read_csv("abc.csv") # Enter path of CSV files containing emails
|
10 |
+
to_addr=data['email'].tolist() # Change'email' to column name containg emailids
|
11 |
+
name = data['name'].tolist()
|
12 |
+
|
13 |
+
l=len(name)
|
14 |
+
email="" #Enter Your email id here
|
15 |
+
password="" #Enter your Password
|
16 |
+
|
17 |
+
for i in range (l):
|
18 |
+
msg=MIMEMultipart()
|
19 |
+
msg['From']=from_addr
|
20 |
+
msg['To']=to_addr[i]
|
21 |
+
msg['Subject']='Just to Check'
|
22 |
+
|
23 |
+
body=name[i]+'Enter your content here'
|
24 |
+
|
25 |
+
msg.attach(MIMEText(body,'plain'))
|
26 |
+
|
27 |
+
mail=smtplib.SMTP('smtp.gmail.com',587)
|
28 |
+
mail.ehlo()
|
29 |
+
mail.starttls()
|
30 |
+
mail.login(email,password)
|
31 |
+
text=msg.as_string()
|
32 |
+
mail.sendmail(from_addr,to_addr[i],text)
|
33 |
+
mail.quit()
|