-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmail.py
32 lines (24 loc) · 844 Bytes
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def Mail(email, name):
gmail_user = '[email protected]'
gmail_password = 'ohyeah!!!!'
msg = MIMEMultipart()
msg['From'] = gmail_user
msg['To'] = email
msg['Subject'] = "Review Bay Registration Confirmation"
body = '''
Dear {},
Congratulations, you have successfully registered on review bay. We are expecting a lot of data analysis with you ahead!
h3lloworld.py
'''.format(name)
body = MIMEText(body)
msg.attach(body)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login(gmail_user, gmail_password)
server.sendmail(gmail_user, email, msg.as_string())
server.close()
print('Email sent!')