-
Notifications
You must be signed in to change notification settings - Fork 1
/
iphone6_log.py
28 lines (26 loc) · 982 Bytes
/
iphone6_log.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
#!/usr/bin/python
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import os
import iphoneconfig
def sendGmailSmtp(strGmailUser,strGmailPassword,strRecipient,strSubject,strContent):
strMessage = MIMEMultipart()
strMessage['From'] = strGmailUser
strMessage['To'] = strRecipient
strMessage['Subject'] = strSubject
strMessage.attach(MIMEText(strContent))
mailServer = smtplib.SMTP('smtp.gmail.com', 587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login(strGmailUser, strGmailPassword)
mailServer.sendmail(strGmailUser, strRecipient, strMessage.as_string())
mailServer.close()
return 'send successed'
data = list(open(iphoneconfig.log_data,"r"))
stringdata = ""
for s in data:
stringdata += s
print sendGmailSmtp(iphoneconfig.emailgatewayID,iphoneconfig.emailpwd,iphoneconfig.systememail,'Daily Iphone6 Log', stringdata)
os.remove(iphoneconfig.log_data)