def get_config(self, filename):

        try:
            tree = ET.parse(filename)
        except IOError as e:
            raise ConfigError("File handling error: %s" % e)
        except ET.ParseError as e:
            raise XmlError("Error in xml syntax: %s" % e)

        root = tree.getroot()

        pattern = root.find('pattern')
        if pattern is not None:
            self.pattern = re.compile(pattern.text)
        else:
            raise ConfigError("Pattern is not found in the %s" % filename)

        timeout = root.find('timeout')
        if timeout is not None:
            self.timeout = int(timeout.text)

        log_file = root.find('logfile')
        if log_file is not None:
            self.log_file = log_file.text
        else:
            raise ConfigError("Log file is no spicified in %s" % filename)

        mailconfig = root.find('mailconfig')
        if mailconfig is not None:
            mailconfig_str = ET.tostring(mailconfig)
            self.mail_handler = sendmail.SendMail(mailconfig_str)
        else:
            raise ConfigError("Mailconfig is not found in %s" % filename)
Ejemplo n.º 2
0
 def post(self):
     username = self.get_argument('txtName')
     password = self.get_argument('txtPwd')
     sex = self.get_argument('sex')
     txtEmail = self.get_argument('txtEmail')
     txtColege = self.get_argument('txtColege')
     print "[Regist]", username, password, sex, txtEmail, txtColege
     if (CheckUserRegisted(username)):
         #已经被人注册了
         print "[-]username already registed"
         self.redirect('/register.html?error=1')
         return
     sql = sqlite3.connect("chatroom.db")
     sql.execute(
         "insert into user (name,password,email,gender,verify,valid) values('{}','{}','{}','{}','{}','{}')"
         .format(username, password, txtEmail, sex,
                 md5.md5(username).hexdigest(), 0))
     sql.commit()
     sql.close()
     varifyUrl = "http://" + address + "/verify?action=" + md5.md5(
         username).hexdigest()
     mailword = '{},welcome,thanks for your registering!Please confirm your regist!\n{}'.format(
         username, varifyUrl)
     sendmail.SendMail(txtEmail, "[Chatroom]Confirm regist", mailword)
     self.redirect('/login.html')
    def get_config(self, root):
       
        pattern = root.find('pattern')
        if pattern is not None:
            self.pattern = re.compile(pattern.text)
        else:
            raise ConfigError("Pattern is not found in the %s" % filename)

        timeout = root.find('timeout')
        if timeout is not None:
            self.timeout = int(timeout.text)

        
        update_interval = root.find('UpdateInterval')
        if update_interval is not None:
            try:
                self.update_interval = float(update_interval.text) / 1000
            except ValueError:
                raise ConfigError("Update interval (ms) should be integer")

        log_file = root.find('logfile')
        if log_file is not None:
            self.log_file = log_file.text        
        else:
            raise ConfigError("Log file is no spicified in %s" % filename)

        mailconfig = root.find('mailconfig')
        if mailconfig is not None:
            mailconfig_str = ET.tostring(mailconfig)
            self.mail_handler = sendmail.SendMail(mailconfig_str)
        else:
            raise ConfigError("Mailconfig is not found in %s" % filename)

        self._process_on_event(root)
Ejemplo n.º 4
0
def Mail_System(msg_recipient, recipient_name):
    import sendmail

    mail = sendmail.SendMail('srmgupta', 'SRM@75000')

    msg_from = 'HDFC RED <*****@*****.**>'
    msg_subject = 'HDFC RED: Recommended Properties For You'

    msg_text = '<html><body><p>Hi %s, </p><p>Hope you are doing well.</p><p><b>Recommended Projects</b></p><p>Take a look at our exclusive recommendation for you.</p><br><table><tbody><tr><td><div style="float:left;width:125px;padding-right:5px;padding-bottom:35px"><a href="http://mandrillapp.com/track/click/30604381/www.hdfcred.com?p=eyJzIjoid096Mktxck1Ea1pMNFRDeTlldkRZXzdnSWgwIiwidiI6MSwicCI6IntcInVcIjozMDYwNDM4MSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvd3d3LmhkZmNyZWQuY29tXFxcL3BpZC0xMjkxXCIsXCJpZFwiOlwiNTUyNGU3NjYzODQyNGQwMGE1M2U5ODU5MDYyYjg4Y2VcIixcInVybF9pZHNcIjpbXCI0MDRmNzUxZjFmNjgwZjQyOTFlZDI4NzA0NWY1OTA1ZGJiYzcxYzcxXCJdfSJ9" style="display:block" target="_blank"><div><div><img class="CToWUd" src="https://www.hdfcred.com/project-images1/728/728_Lifestyle_City_HD.jpg" height="100" width="100"><small>Vinay Unique Developers <br> <span>32 L+  </span></small></div></div></a></div></td><td><div style="float:left;width:125px;padding-right:5px;padding-bottom:35px"><a href="http://mandrillapp.com/track/click/30604381/www.hdfcred.com?p=eyJzIjoiaWJIdXVqajYxRkNwREpsS3QzZ2VmUVFjWjlrIiwidiI6MSwicCI6IntcInVcIjozMDYwNDM4MSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvd3d3LmhkZmNyZWQuY29tXFxcL3BpZC0xNDMwXCIsXCJpZFwiOlwiNTUyNGU3NjYzODQyNGQwMGE1M2U5ODU5MDYyYjg4Y2VcIixcInVybF9pZHNcIjpbXCI0MDRmNzUxZjFmNjgwZjQyOTFlZDI4NzA0NWY1OTA1ZGJiYzcxYzcxXCJdfSJ9" style="display:block" target="_blank"><div><div><img class="CToWUd" src="https://ci5.googleusercontent.com/proxy/XGEjoax_09OerduoAMdIX7KookLjMucm16ok6FwZV7cx40R89b-3StUlOjB-M9mTyQ-ARv3M-TR3_a5NYuCcGUq6zkwfA2ySUQ6T-ceoG8rWM2uDOwZh9Q=s0-d-e1-ft#https://www.hdfcred.com/project-images1/1430/1430_Chhaya_Niwas.jpg" height="100" width="100"><small>Usha Breco Realty Limited<br> <span>25 L+  </span></small></div></div></a></div></td><td><div style="float:left;width:125px;padding-right:5px;padding-bottom:35px"><a href="http://mandrillapp.com/track/click/30604381/www.hdfcred.com?p=eyJzIjoiTWp0MlUwZVZaSUkydGUxQWlGQXl6TEdGZUkwIiwidiI6MSwicCI6IntcInVcIjozMDYwNDM4MSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvd3d3LmhkZmNyZWQuY29tXFxcL3BpZC0xNTY4XCIsXCJpZFwiOlwiNTUyNGU3NjYzODQyNGQwMGE1M2U5ODU5MDYyYjg4Y2VcIixcInVybF9pZHNcIjpbXCI0MDRmNzUxZjFmNjgwZjQyOTFlZDI4NzA0NWY1OTA1ZGJiYzcxYzcxXCJdfSJ9" style="display:block" target="_blank"><div><div><img class="CToWUd" src="https://ci4.googleusercontent.com/proxy/6vLYuconv2DMb_gnwdiB2wtJsiioU2YdlupJEHDc2Pp0-a3Y83t-Mrah9svzYh1DFpqeGDNPPbIiexqaoKEvIoYhRKly4ReLx0n3O0Qx8r3ALmFuKM34LZQ=s0-d-e1-ft#https://www.hdfcred.com/project-images1/1568/1568_Eco_Eden_City.jpg" height="100" width="100"><small>Mayuresh Group<br> <span>31 L+  </span></small></div></div></a></div></td></tr></tbody></table></body></html>' % (
        recipient_name)

    mail.send_mail(msg_recipient, msg_from, msg_subject, msg_text)
Ejemplo n.º 5
0
 def SendMail(self, to, frm, subject):
     import sendmail
     if self.log:
         replyto = frm
         sendmail.SendMail(to, frm, replyto, subject, self.log)
Ejemplo n.º 6
0
parser.add_option('-e', '--email',
                    action='store_true', dest='email', default=False, help='send an e-mail when an event occurs. %default by default')

(options, args) = parser.parse_args()

if len(args) == 1:
    directory = args[0]

elif len(args)>1:
    print 'incorrect number of arguments'
    sys.exit(2)


if options.email:
    mail = sendmail.SendMail()
    print 'e-mail option set'


wm = pyinotify.WatchManager()
flags = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_MOVED_TO

class EventHandler(pyinotify.ProcessEvent):
    
    def process_IN_CLOSE_WRITE(self, event):
        print "\n%s Finished writing: %s"%(time.strftime('%a %d-%m-%Y %H:%M:%S'),event.pathname)
        if event.pathname[-3:]=='mkv':
            print '\n-------------------------------\nStarting conversion of %s' % event.pathname
            converter.convert(event.pathname)

            if options.email: 
Ejemplo n.º 7
0
 def __init__(self, _cat, _trigger, _val, _com=None, _validity=3600):
     self.mail = sendmail.SendMail()
     self.ring = ringring.RingRing()
     self.alert = (_cat, _trigger, _val, _com, int(_validity))
     self.fs = 0
Ejemplo n.º 8
0
                            sp = pyttsx3.init()
                            sp.say("Incorrect OTP")
                            sp.runAndWait()

                    except:
                        sp1 = pyttsx3.init()
                        sp1.say(
                            "Sorry, we are unable to perform the operations..Please wait.."
                        )
                        sp1.runAndWait()
                break
            else:
                cv2.imwrite(
                    f"{path_to_dir}//intruder//intruder" + str(intr) + '.jpg',
                    frame)
                sendmail.SendMail(f"{path_to_dir}//intruder//intruder" +
                                  str(intr) + '.jpg')
                cv2.imshow('Face Recognition', image)
                time.sleep(40)
                imapper = easyimap.connect('imap.gmail.com', From, Password)
                for mail_id in imapper.listids(limit=1):
                    mail = imapper.mail(mail_id)
                    #                     print("hi")
                    print(mail.body[0:3])
                    if mail.body[0:3] == "yes" or mail.body[0:3] == "Yes":
                        #door unlock
                        ser.write(b'v')
                        time.sleep(10)
                break

        else:
            cv2.putText(image, "Locked", (250, 450), cv2.FONT_HERSHEY_COMPLEX,