def ping(frm): print '<====== Funcion ping() ======>' ip = to.ip().rstrip() # get the public IP print 'ip=',ip #print 'echo "La IP de Gallifrey es: %s" | mutt %s'%(ip,mail) host = os.uname()[1] # get the hostname ## Reply dest = frm body = 'La IP de %s es: %s'%(host,ip) sub = 'PING' mt.send_mail(dest,body,subject=sub)
def photo(frm,path='/tmp/silent_guardian'): print '<====== Funcion photo() ======>' os.system('mkdir -p %s'%(path)) command = 'streamer -f jpeg -o %s/image.jpeg '%(path) print 'Hago foto (opencv... whatever)' os.system(command) ## Reply print 'Envio mail con foto (mutt)' dest = frm now = dt.datetime.now().strftime("%Y-%m-%d %H:%M") body = 'Ahí va la foto @ %s'%(now) sub = 'PHOTO' att = '%s/image.jpeg '%(path) mt.send_mail(dest,body,subject=sub,attach=att)