-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinal_Project.py
37 lines (27 loc) · 1.16 KB
/
Final_Project.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
33
34
35
36
37
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
von = "[email protected]"
with open('receiver.txt', 'r') as file:
zum = file.read().replace('\n', ',')
msg = MIMEMultipart()
msg['From'] = von
msg['To'] = zum
msg['Subject'] = "Greetings From ALTERSPACE-145GU21"
body = "Hi, thank you so much for reading my email. I hope you are in good health and kept away from all bad things. Congratulations on your acceptance to become one of the leaders in the ALTER3675324 project this time. I hope we can work well together."
msg.attach(MIMEText(body, 'plain'))
filename = "ThankYOU.jpg"
attachment = open(r'C:\users\asus\Downloads\thankyou.jpg', 'rb')
part = MIMEBase('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', "attachment; filename= %s" % filename)
msg.attach(part)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(von, "akusayangnihao")
text = msg.as_string()
server.sendmail(von, zum, text)
server.quit()