how to view modules perl installed by cpan

instmodsh
Advertisements

Script para enviar Email em Perl

#!/usr/bin/perl -w

use Data::Dumper;
use MIME::Lite;

if ( scalar @ARGV != 3 ) {
  print 'ERRO!!!! Faltando parametros!', $/, 'Use: ', $0, ' email_destino@mydomain.com assunto corpo_email', $/;
  print Dumper( @ARGV );
} else {
  print 'enviando email para: ', $ARGV[0], $/;
  envia_email(`hostname -s`, $ARGV[0], $ARGV[1], $ARGV[2]);
}

sub envia_email {
  local ($from, $to, $subject, $message) = @_;

  $email = MIME::Lite->new(
  From => $from,
  To => $to,
  Type => 'text/html',
  Subject => $from . ' ' . $subject,
  Data => $message
  );
  MIME::Lite->send('smtp', 'mail.,mydomain.com', DEBUG=>1);
  $email->send();
}