File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import smtplib
2+ import ssl
3+ from email.mime.multipart import MIMEMultipart
4+ from email.mime.text import MIMEText
5+
6+ try:
7+ email = "<< Enter your email >>"
8+ password = "<< Enter your password"
9+ to = "<< Enter sender email >>"
10+ msg = """ << Email Body >>"""
11+ message = MIMEMultipart()
12+ message["From"] = email
13+ message["To"] = to
14+ message["Subject"] = "HacktoberFest 2019"
15+ message.attach(MIMEText(msg, "plain"))
16+ context = ssl.create_default_context()
17+ server = smtplib.SMTP("smtp.gmail.com")
18+ server.starttls()
19+ server.ehlo()
20+ server.login(email, password)
21+ server.sendmail(email, to, message.as_string())
22+ print('Email have been successfully send')
23+
24+ except Exception as ex:
25+ print(ex)
26+
27+ finally:
28+ server.quit()
You can’t perform that action at this time.
0 commit comments