Advertisement
josacar

seguimiento.pl

Mar 21st, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.01 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use strict;
  4. use MIME::Lite;
  5. my $email = '';
  6. my $email2 = '';
  7.  
  8.  
  9. my $SQL = "select evento.idevento as ticket,evento.descripcion,empresa.nombre as cliente,areaconocimiento.nombre as area
  10.        from evento, empresa,areaconocimiento
  11.        where empresa.idempresa=evento.idempresa
  12.                and evento.modificacion < now()::timestamp - interval '14 days'
  13.                and evento.idestadoev != 40
  14.                and evento.idarea!= 45
  15.                and areaconocimiento.habilitada = 1
  16.                and areaconocimiento.idarea=evento.idarea
  17.        order by empresa.nombre;";
  18.  
  19. my $comando = 'echo "\H \\\\\\ '. $SQL .'" | PGUSER=postgres psql -q -d XXXX';
  20.  
  21. my $TABLA = `$comando`;
  22.  
  23. $TABLA = '<html><head><title></title></head><body><div></div>' . $TABLA . '</body></html>';
  24.  
  25. my $msg = MIME::Lite->new
  26. (
  27. Subject => "XXX",
  28. From    => 'XXXX',
  29. To      => $email,
  30. Cc      => $email2,
  31. Type    => 'text/html',
  32. Encoding => '8bit',
  33. Data    => $TABLA
  34. );
  35. $msg->send();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement