def save_to_db(f):
    if f.has_key("datetime") and len(f["datetime"]) != 0:
	f["datetime"] = datetime.datetime.strptime(f["datetime"], '%Y-%m-%d %H:%M:%S')
    else:
	f["datetime"] = None

    email_model = SentEmail(f["to_name"], f["to"], f["from_name"], f["from"], f["subject"], f["body"], f["service"], f["service_response"], f["datetime"])
    db_session.add(email_model)
    db_session.commit()
def save_to_db(f):
    email_model = SentEmail(f["to_name"], f["to_email"], f["from_name"], f["from_email"], f["subject"], f["body"], f["service"], f["service_response"])
    db_session.add(email_model)
    db_session.commit()