Example #1
0
	def biz(self, m):
		exes  = executor_lst()
		t = 'Help\n\n'
		for (k,e) in exes.iteritems():
			if e.help():
				t = t + 'command: %s' % e.cmd_name() + '\n'
				t = t + e.help() + '\n\n'
		return {'body': t}		
Example #2
0
                        sm['To'] = Header(m.frm, 'gb2312').encode()
                        sm['From'] = 'DiPi <*****@*****.**>'
                        sm.attach(MIMEText(res['body'].encode('gbk')))
                        if res.has_key('file') and res['file']:
                            sm.attach(MIMEImage(file(res['file']).read()))
                        server.sendmail('DiPi <*****@*****.**>',
                                        m.frm.encode('gbk'), sm.as_string())
                        server.quit()

    M.close()
    M.logout()


from daemon import Daemon


class dipimon(Daemon):
    def run(self):
        while (True):
            get_new_mail(es)


if __name__ == "__main__":
    es = executor_lst()
    dpm = dipimon('dipi.pid')
    if (len(sys.argv) > 1) and sys.argv[1] == '-d':
        print 'daemon mode'
        dpm.start()
    else:
        print 'console mode'
        dpm.run()
Example #3
0
						server.login(config.EMAIL_USER, config.EMAIL_PASS)
						sm = MIMEMultipart()
						sm['Subject'] = Header(u'Re: ' + m.title, 'gb2312').encode()
						sm['To'] = Header(m.frm,'gb2312').encode()
						sm['From'] = 'DiPi <*****@*****.**>'
						sm.attach(MIMEText(res['body'].encode('gbk')))
						if res.has_key('file') and res['file']:
							sm.attach(MIMEImage(file(res['file']).read()))
						server.sendmail('DiPi <*****@*****.**>', m.frm.encode('gbk'), sm.as_string())
						server.quit()

					
	M.close()
	M.logout()

from daemon import Daemon

class dipimon(Daemon):
    def run(self):
        while(True):
			get_new_mail(es)
	
if __name__ == "__main__":
	es = executor_lst()
	dpm = dipimon('dipi.pid')
	if(len(sys.argv)>1) and sys.argv[1] == '-d':
		print 'daemon mode'
		dpm.start()
	else:
		print 'console mode'
		dpm.run()