-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemails.py
More file actions
63 lines (46 loc) · 1.48 KB
/
emails.py
File metadata and controls
63 lines (46 loc) · 1.48 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def send_email_attachment(to, subject, text, attachment):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
fromaddr = "registerer69@gmail.com"
toaddr = to
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = subject
body = text
msg.attach(MIMEText(body, 'plain'))
filename = attachment
attachment = open(attachment, "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(fromaddr, "bojangles1")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
def send_email_plain(recipient, subject, text):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
fromaddr = "registerer69@gmail.com"
toaddr = recipient
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = subject
body = text
msg.attach(MIMEText(body, 'plain'))
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(fromaddr, "bojangles1")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
send_email_plain("fulton.derek@gmail.com", "SUBJECT", "FUCK YOU")