-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathSMTP.py
34 lines (28 loc) · 834 Bytes
/
SMTP.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
#!/usr/bin/python3
__author__ = 'kilroy'
# (c) 2014, WasHere Consulting, Inc.
# Written for Infinite Skills
import smtplib
from email.mime.text import MIMEText
# ehlo foo.com
# mail from: [email protected]
# rcpt to: [email protected]
# data
s = smtplib.SMTP("172.30.42.127", 25)
#s.login("user", "password")
try:
# could use the following for a MIME message
# f = open("myfile", "r")
# m = MIMEText(f.read())
# f.close()
# m['To'] = "[email protected]"
# m['From'] = "[email protected]"
# m['Subject'] = "This is a message to you"
m = "\nThis is a message from the last session"
s.sendmail("[email protected]", "[email protected]", m)
# send the MIME message
# s.send_message(m)
print("Finished sending message")
except Exception as e:
print("Unable to send message: ", e)
s.quit()