Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
36 lines (26 loc) · 1.03 KB

File metadata and controls

36 lines (26 loc) · 1.03 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
33
34
35
36
###### Notice ######
# before sending email you have to enable your less secure apps access in your sending mail (xyz@gmail.com)
import smtplib
from email.message import EmailMessage
EMAIL_ADDRESS = "xyz@gmail.com" # your email-id goes here
EMAIL_PASSWORD = "xyz" # your password goes here
msg = EmailMessage()
msg['Subject'] = 'this is subject'
msg['From'] = EMAIL_ADDRESS
msg['To'] = EMAIL_ADDRESS
msg.set_content('Content area')
msg.add_alternative("""\
<html>
<body>
<h1>Your HTML CONTENT GOES HERE </h1>
</body>
</html>
""", subtype='html')
with open('testing.txt', 'rb') as f: # your filename will go here
file_data = f.read()
file_name = f.name
msg.add_attachment(file_data, maintype='application', subtype='octet-stream', filename=file_name)
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
smtp.send_message(msg)
print("Email Sent Successfully ..")
Morty Proxy This is a proxified and sanitized view of the page, visit original site.