示例#1
0
def send_email():
    # if request.method == "POST":
    email_dict = request.json
    message = email_dict["message"]
    reply_to = email_dict["reply_to"]
    print email_dict
    sendmail.mail(message, reply_to)
    return jsonify(response="success")
示例#2
0
def sendmail():
    while True:
        readq = handle.qpdu.get()
        #print("PDU from Q:",readq)
        if pingdemo.Netchk() :
            logmsg_unmail(readq)
        else :
            mail(readq)
示例#3
0
def main():
    global logger
    global _client
    logger = logging.getLogger("zhuhaiyeyouClient")
    try:
        connect_zhyy_server()
        process()
    except Exception, e:
        sendmail.mail(config_test.sendmail['sender'],
                      config_test.sendmail['receivers'], '珠海页游数据同步脚本故障',
                      str(e))
示例#4
0
def main():
    global logger
    global _client
    logger = logging.getLogger("zhuhaiyeyouClient")
    try:
        connect_zhyy_server()
        process()
    except Exception, e:
        sendmail.mail(config_test.sendmail['sender'],
                config_test.sendmail['receivers'],
                '珠海页游数据同步脚本故障',
                str(e))
示例#5
0
def main():
    global _client
    init(config_test.db_config)
    try:
        connect_server(config_test.thrift_server['ip'],
                config_test.thrift_server['port'])
        result = _client.getUrlBySrcUrl('http://a.9game.cn/game/downs_10_2.htm')
        print "result is : ",result
        uncomplete_task = find_uncomplete_task()
        print uncomplete_task
    except Exception, e:
        sendmail.mail(config_test.sendmail['sender'],
                config_test.sendmail['receivers'],
                'test',
                str(e))
示例#6
0
def msginit():

    if handle.isconnect():
        print('A6 is lost...exit()')
        return 1
    if handle.setpdumode() == 'ERR':
        return 'ERR'
    pudmsg = handle.listmsg_unread()

    sendmail = ''
    if len(pudmsg) == 0:
        log("no msg to read")
    else:
        for i in range(0, len(pudmsg)):
            str = decodepdu(pudmsg[i])
            sendmail += '\n'.join(str)
        if pingdemo.Netchk():
            logmsg_unmail(sendmail)
        else:
            mail(sendmail)
示例#7
0
cp2102 = cp2102_open()
handle = A6handle(cp2102)


#handle.sendtestmsg()
#handle.listmsg_unread()
msginit()
t1 = threading.Thread(target=waitformsg)
t2 = threading.Thread(target=readmsg)
t3 = threading.Thread(target=sendmail)

t1.start()
t2.start()
print("thread is running")
while True:
    readq = handle.qpdu.get()
    print("PDU from Q:",readq)
    if pingdemo.Netchk() :
        logmsg_unmail(readq)
    else :
        mail(readq)

'''
handle.sendtestmsg()
while True :
    handle.trg_recmsg()
    handle.getmsgfromQ()

''' 
示例#8
0
infos=buff.read().replace('+', '').replace(' ', '')
buff.close()
cpu_temp = re.findall('temp1:([0-9]*)', infos)[0]
cpu_temp = float(cpu_temp)
pmem = float(psutil.virtual_memory()[2])
cpu = float(psutil.cpu_percent(interval=1))
disk = float(psutil.disk_usage('/')[3])


#Verifier est ce que c'est en sitution de crise
text = "\n"
if cpu_crise_decision and cpu >= cpu_crise :
	buff = os.popen("mail_alerte.sh "+str(cpu))
	text = buff.read()
	buff.close()
	sendmail.mail("Niveau Critique CPU ",str(text))
if ram_crise_decision and pmem >= ram_crise :
	buff = os.popen("mail_alerte.sh "+str(pmem))
	text = buff.read()
	buff.close()
	sendmail.mail("Niveau Critique RAM",str(text))
if disk_crise_decision and disk >= disk_crise:
	buff = os.popen("mail_alerte.sh "+str(disk))
	text = buff.read()
	buff.close()
	sendmail.mail("Niveau Critique Disque",str(text))
if cpu_temp_crise_decision and cpu_temp >= cpu_temp_crise :
	buff = os.popen("mail_alerte.sh "+str(cpu_temp))
	text = buff.read()
	buff.close()
	sendmail.mail("Niveau Critique Temperature",str(text))
示例#9
0
from sendmail import mail
import os
obj = mail(input("请输入您的smtp服务器地址:"), input("请输入您的邮箱地址:"), input("请输入您的授权码:"))
while 1:
    os.system("cls")
    print("您的选择:\n\n1:发送邮件\n\n2:退出")
    c = input("请选择:")
    if c == "1":
        os.system("cls")
        obj.send(input("请输入收件人地址:"), input("请输入邮件的正文:"), input("请输入邮件的标题:"))
        pass
    elif c == "2":
        exit()
        pass
    pass
示例#10
0
def read_postdata_json(file_path=get_filepath()):
    json_filename = file_path + 'post_data.json'
    with open(json_filename, encoding='UTF-8') as f:
        post_data2 = json.load(f)
    return post_data2


def write_postdata_json(uid, upw, file_path=get_filepath()):
    json_filename = file_path + 'post_data.json'
    post_data2 = {'uid': uid, 'upw': upw, 'smbtn': '进入健康状况上报平台', 'hh28': '686'}
    with open(json_filename, 'w', encoding='UTF-8') as f:
        json.dump(post_data2, f)


if __name__ == '__main__':
    sendmail = sendmail.mail()
    print('正在读取数据...')
    submit_data = read_submitdata_json()
    print(submit_data)
    user_data = read_userdata_json()
    print('读取数据成功!')
    for user in user_data:
        init()
        print('正在写入数据...')
        write_postdata_json(user['uid'], user['upw'])
        print('写入数据成功!')
        print('正在读取表单...')
        post_data = read_postdata_json()
        print('读取表单成功!')
        post = jksb.jksb(user, post_data, submit_data)
        e_mail = user['mail']
示例#11
0
import sendmail
import markdown

user = raw_input("user: "******"subject: ")
text = open(raw_input("file: "), "r").read()

attach = raw_input("attachments? ")[0].lower()
attachments = list()
while attach == 'y':
    attachments.append(raw_input("path: "))
    attach = raw_input("another? ")[0].lower()

print "attachments", attachments

sendmail.mail(user, "*****@*****.**", sub, text,
              markdown.markdown(text).replace('<br>', ''), *attachments)
# chargement de la configuration
taille_max=os.popen('cat '+FICHIER_CONFIG+' || echo '+DEFAULT_TAILLE)
taille_max = float(taille_max.read())
taille_act=os.popen("ls -la "+FICHIER_SERVEUR+"|cut -d' ' -f5")
taille_act = float(taille_act.read())/1000000

if taille_max <= taille_act :# SI la taille est  superieur a la limite on supprime les donnees
	os.popen('./'+FICHIER_Delete_data+" "+FICHIER_SERVEUR+" ram cpu NmbUserConnecte disque NmbProcessus ram cert")
#Recherche d'alerte 
d = feedparser.parse('http://www.cert.ssi.gouv.fr/site/cert-fr.rss ')
v=d.entries
con = lite.connect(FICHIER_SERVEUR)
with con:
	for ent in d.entries :
		titre = ent.title.encode('utf-8')		
		lien=ent.link.encode('utf-8')
		description=ent.description.encode('utf-8')
		script = "INSERT INTO  cert (title ,resume ,lien) values ('"+str(titre)+"','"+str(description)+"','"+str(lien)+"')"
		cur = con.cursor()		
		try :
			cur.execute(script)# Enregistrement dans la base	
			mess = os.popen("mail_cert.sh "+titre+ " "+description+" "+" "+lien)
			mess = mess.read() 			
			sendmail.mail('cert',mess)
		except :
			print ""		
		cur.close()
print mess
#u'For documentation <em>only</em>'

    image = frame.array

    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)

    # Take foto when createria are met
    if take_foto == True and j < 6:
        cv2.imwrite('Doormen/Doorman' + str(i) + '.png', image)
        sendUI_update('Doormen/Doorman' + str(i) + '.png')
        take_foto = False

    if (sec % wait_sec) == 0 and j == 6:
        sec_prev = sec
        j = 0
        # Send dat mail
        mail()

    # Display the resulting frame
    for (x, y, w, h) in faces:
        cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 1)
        roi_gray = gray[y:y + h, x:x + w]
        roi_color = image[y:y + h, x:x + w]
        if h > 50 and j < 6:
            take_foto = True
            i += 1
            j += 1

    # Show the frame
    #cv2.imshow("Doorcam", image)
    key = cv2.waitKey(1) & 0xFF