Example #1
0
def start_filesysmail():

    dbsession = orm.create_session()
    db = dbsession()

    fm = FileSysMail.get_instance()

    smtp_server = SiteConfig.get(
        db, 'notice.smtp.server', '127.0.0.1')
    smtp_port = int(SiteConfig.get(
            db, 'notice.smtp.port', 25 ))
    smtp_username = SiteConfig.get(
        db, 'notice.smtp.username', None)
    smtp_password = SiteConfig.get(
        db, 'notice.smtp.password', None)

    mail_dir = SiteConfig.get(
        db, 'site.send_mail.dir', '/opt/LuoYun/run/email/')

    print 'smtp_server   = ', smtp_server
    print 'smtp_port     = ', smtp_port
    print 'smtp_username = '******'smtp_password = ', smtp_password

    fm.init( smtp_server, smtp_username, smtp_password,
             smtp_port = smtp_port, store_path = mail_dir )

    fm.start()

    dbsession.remove()
Example #2
0
def start_filesysmail():

    dbsession = orm.create_session()
    db = dbsession()

    fm = FileSysMail.get_instance()

    smtp_server = SiteConfig.get(db, 'notice.smtp.server', '127.0.0.1')
    smtp_port = int(SiteConfig.get(db, 'notice.smtp.port', 25))
    smtp_username = SiteConfig.get(db, 'notice.smtp.username', None)
    smtp_password = SiteConfig.get(db, 'notice.smtp.password', None)

    mail_dir = SiteConfig.get(db, 'site.send_mail.dir',
                              '/opt/LuoYun/run/email/')

    dbsession.remove()

    print 'smtp_server   = ', smtp_server
    print 'smtp_port     = ', smtp_port
    print 'smtp_username = '******'smtp_password = '******'mail_dir      = ', mail_dir

    if fm.init(smtp_server,
               smtp_username,
               smtp_password,
               smtp_port=smtp_port,
               store_path=mail_dir):
        logging.info('FileSysMail init success.')
        fm.start()
        return True

    else:
        logging.error('FileSysMail init failed.')
        return False
Example #3
0
def exit_handler(_signal, frame):

    if _signal == signal.SIGINT:
        print " ... You Pressed CTL+C, exit ... "

    elif _signal == signal.SIGHUP:
        print " ... get SIGHUP, exit ... "

    if _signal == signal.SIGTERM:
        print " ... get SIGTERM, exit ... "


#    db.dispose()

    # TODO: quit email
    try:
        from yweb.mail import FileSysMail
        fm = FileSysMail.get_instance()
        fm.end()
    except RuntimeError:
        pass

    sys.exit(1)
Example #4
0
def exit_handler(_signal, frame):

    if _signal == signal.SIGINT:
        print " ... You Pressed CTL+C, exit ... "

    elif _signal == signal.SIGHUP:
        print " ... get SIGHUP, exit ... "

    if _signal == signal.SIGTERM:
        print " ... get SIGTERM, exit ... "


#    db.dispose()

# TODO: quit email
    try:
        from yweb.mail import FileSysMail
        fm = FileSysMail.get_instance()
        fm.end()
    except RuntimeError:
        pass

    sys.exit(1)
Example #5
0
def start_filesysmail():

    dbsession = orm.create_session()
    db = dbsession()

    fm = FileSysMail.get_instance()

    smtp_server = SiteConfig.get(
        db, 'notice.smtp.server', '127.0.0.1')
    smtp_port = int(SiteConfig.get(
            db, 'notice.smtp.port', 25 ))
    smtp_username = SiteConfig.get(
        db, 'notice.smtp.username', None)
    smtp_password = SiteConfig.get(
        db, 'notice.smtp.password', None)

    mail_dir = SiteConfig.get(
        db, 'site.send_mail.dir', '/opt/LuoYun/run/email/')

    dbsession.remove()

    print 'smtp_server   = ', smtp_server
    print 'smtp_port     = ', smtp_port
    print 'smtp_username = '******'smtp_password = '******'mail_dir      = ', mail_dir

    if fm.init( smtp_server, smtp_username, smtp_password,
                smtp_port = smtp_port, store_path = mail_dir ):
        logging.info('FileSysMail init success.')
        fm.start()
        return True

    else:
        logging.error('FileSysMail init failed.')
        return False