-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver_finally4.py
More file actions
40 lines (28 loc) · 903 Bytes
/
server_finally4.py
File metadata and controls
40 lines (28 loc) · 903 Bytes
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
38
39
40
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
email_user = 'son33620812@gmail.com'
email_password = 'hlove3308'
email_send = 'son33620812@gmail.com'
subject = 'project finish??'
msg = MIMEMultipart()
msg['From'] = email_user
msg['To'] = email_send
msg['Subject'] = subject
body = 'project finish~~'
msg.attach(MIMEText(body,'plain'))
filename='hello.mp4'
attachment =open(filename,'rb')
part = MIMEBase('application','octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition',"attachment; filename= "+filename)
msg.attach(part)
text = msg.as_string()
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(email_user,email_password)
server.sendmail(email_user,email_send,text)
server.quit()