-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheml.py
More file actions
38 lines (30 loc) · 888 Bytes
/
eml.py
File metadata and controls
38 lines (30 loc) · 888 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
import smtplib
# aaaaaaaaaaaa
def send_email(user, pwd, recipient, subject, body):
FROM = user
TO = recipient if type(recipient) is list else [recipient]
SUBJECT = subject
TEXT = body
# Prepare actual message
message = """From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.ehlo()
server.starttls()
server.login(user, pwd)
server.sendmail(FROM, TO, message)
server.close()
print('successfully sent the mail')
except Exception as ex:
print("failed to send mail")
usr = "botuserbox@gmail.com"
pwd = "b0td3mo0ne"
rcp = "jborelo@gmail.com"
subj = "PythnonEmailTests"
body = "asasasasa" \
"ewrewrewrewr" \
"wrewrewrewrew"
parser = Sa
#send_email(usr, pwd, rcp, subj, body)
print ("DONE")