def send_mo_email(): global lat global lon global mo_buffer global momsn global mtmsn global email global incoming_server global outgoing_server global password global imei # put together body body = "Field-Control Unit Was Mentioned on Twitter" # subject subject = "Twitter to SBD" # message is included as an attachment attachment = "text.txt" fd = open(attachment, "wb") fd.write(mo_buffer) fd.close() sendMail(subject, body, user, recipient, password, outgoing_server, attachment)
def send_mo_email(fcu_name,msg): global email global incoming_server global outgoing_server global password #put together body body = '' try: cursor = database.cursor() cursor.execute("SELECT imei FROM fcu_list WHERE name=?", fcu_name) imei = cursor.fetchone()[0] except: print 'Database access error. FCU name may not exist or DB may be broken.' return #set_last_sent(imei) #set_last_msg_sent(imei,msg) #subject subject = '%d' % imei #message is included as an attachment attachment = 'msg.sbd' fd = open(attachment, 'wb') fd.write(msg) fd.close() sendMail(subject, body, user, recipient, password, outgoing_server, attachment)
def send_mo_email(msg): global email global incoming_server global outgoing_server global password global imei #put together body body = '' #subject subject = '%d' % imei #message is included as an attachment attachment = 'msg.sbd' fd = open(attachment, 'wb') fd.write(msg) fd.close() sendMail(subject, body, user, recipient, password, outgoing_server, attachment)
def send_mo_email(): global lat global lon global mo_buffer global momsn global mtmsn global email global incoming_server global outgoing_server global password global imei #put together body body = \ 'MOMSN: %d\r\n\ MTMSN: %d\r\n\ Time of Session (UTC): %s\r\n\ Session Status: TRANSFER OK\r\n\ Message Size: %d\r\n\ \r\n\ Unit Location: Lat = %8.6f Long = %8.6f\r\n\ CEPRadius = 3\r\n\ \r\n\ Message is Attached.'\ % (momsn, mtmsn, time.asctime(), len(mo_buffer), lat, lon) #subject subject = 'SBD Msg From Unit: %d' % (imei) #message is included as an attachment attachment = 'text.sbd' fd = open(attachment, 'wb') fd.write(mo_buffer) fd.close() sendMail(subject, body, user, recipient, password, outgoing_server, attachment)