Ejemplo n.º 1
0
def authorize_and_send(simulation_num=None,image_files=[],strings_arr=[]):

	if not os.path.exists(config.get_xoauth_filename()):
		instructions(config.get_xoauth_filename());
		exit();
	msg=""
	for s in strings_arr:
		msg = msg + "\n" + s;
#		print s
		
	user,xoauth_string = generate_xoauth_string(config.get_xoauth_filename())
	send_simulation_finished(user,config.get_destination_email() ,xoauth_string,simulation_num,image_files,msg_body=msg); 
	print "Simulation finished message sent";
Ejemplo n.º 2
0
def authorize_and_send(simulation_num=None, image_files=[], strings_arr=[]):

    if not os.path.exists(config.get_xoauth_filename()):
        instructions(config.get_xoauth_filename())
        exit()
    msg = ""
    for s in strings_arr:
        msg = msg + "\n" + s


#		print s

    user, xoauth_string = generate_xoauth_string(config.get_xoauth_filename())
    send_simulation_finished(user,
                             config.get_destination_email(),
                             xoauth_string,
                             simulation_num,
                             image_files,
                             msg_body=msg)
    print "Simulation finished message sent"
Ejemplo n.º 3
0
#this code is extremely loosely based off of: 
# http://code.google.com/p/yjl/source/browse/Python/snippet/gmail-xoauth.py
# it should be run as a cron job -- it will poll the gmail account that you
# access via xoauth and if it sees a message in the 'marss' label, it will send
# back some kind of status report email 

import imaplib
import config

from send_gmail import *
from sim_status import *

user,xoauth_imap_string = generate_xoauth_string(config.get_xoauth_filename(), "IMAP");

# TODO: perhaps this should generate a reply to the sender of the message instead 
dest_email = config.get_destination_email()
label_to_watch = 'marss'

imap_hostname = 'imap.googlemail.com'

# Get unread/unseen list
imap_conn = imaplib.IMAP4_SSL(imap_hostname)
# imap_conn.debug = 4
imap_conn.authenticate('XOAUTH', lambda x: xoauth_imap_string)
# look for the label called 'marss'; mark message as read (readonly=false)
imap_conn.select(label_to_watch, readonly=False)
typ, data = imap_conn.search(None, 'UNSEEN')
unreads = data[0].split()

if (len(unreads) > 0):
	# mark em all read
Ejemplo n.º 4
0
# http://code.google.com/p/yjl/source/browse/Python/snippet/gmail-xoauth.py
# it should be run as a cron job -- it will poll the gmail account that you
# access via xoauth and if it sees a message in the 'marss' label, it will send
# back some kind of status report email

import imaplib
import config

from send_gmail import *
from sim_status import *

user, xoauth_imap_string = generate_xoauth_string(config.get_xoauth_filename(),
                                                  "IMAP")

# TODO: perhaps this should generate a reply to the sender of the message instead
dest_email = config.get_destination_email()
label_to_watch = 'marss'

imap_hostname = 'imap.googlemail.com'

# Get unread/unseen list
imap_conn = imaplib.IMAP4_SSL(imap_hostname)
# imap_conn.debug = 4
imap_conn.authenticate('XOAUTH', lambda x: xoauth_imap_string)
# look for the label called 'marss'; mark message as read (readonly=false)
imap_conn.select(label_to_watch, readonly=False)
typ, data = imap_conn.search(None, 'UNSEEN')
unreads = data[0].split()

if (len(unreads) > 0):
    # mark em all read