Mike, vlw pelo script.

Flws

Em 06-11-2013 16:29, Mike Tesliuk escreveu:
> #!/usr/bin/perl
>
>
> use MIME::Lite;;
> use Net::SMTP;
>
> @ARGV;
>
> my $faxfile = $ARGV['0'];
> my $faxname = $ARGV['1'];
> my $destination = $ARGV['2'];
> my $faxname2 = "/var/spool/asterisk/fax/" . $faxname;
>
> system("tiff2pdf -o $faxname2 $faxfile");
>
> my ($sec,$min,$hour,$mday,$mon,$year,
>           $wday,$yday,$isdst) = localtime time;
>
> if(!$destination){
>     $destination = "EU\@MEUDOMINIO";
> }
>
> $msg = MIME::Lite->new(
>     From => 'pabx_COMPANIA@DOMINIO',
>     To => '$destination',
>     Subject => "Fax recebido em $mday/" . ($mon + 1) . "/" . ($year + 
> 1900) . " as $hour:$min:$sec ",
>     Type => 'multipart/mixed'
> );
>
> $msg->attach(
>     Type => 'TEXT',
>     Data => "Ola!, \n\nVoce recebeu um novo fax, o arquivo esta em 
> anexo.\n\nAtt. Equipe de Tecnologia COMPANIA\n"
> );
>
> $msg->attach(
>     Type => 'application/x-pdf',
>     Path => "$faxname2",
>     Filename => "$faxname",
>     Disposition => 'attachment'
> );
>
> $smtp = Net::SMTP->new(Host => "SERVIDOR_SMTP",
>     Debug => 1,
> );
> $smtp->auth("USUARIO\@DOMINIO", "SENHA");
> $smtp->mail("USUARIO\@DOMINIO");
> $smtp->to("$destination");
> $smtp->data();
> $smtp->datasend( $msg->as_string );
> $smtp->dataend();
> $smtp->quit();

_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;
Intercomunicadores para acesso remoto via rede IP. Conheça em www.Khomp.com.
_______________________________________________
ALIGERA – Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7.
Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.
Channel Bank – Appliance Asterisk - Acesse www.aligera.com.br.
_______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para 
asteriskbrasil-unsubscr...@listas.asteriskbrasil.org

Responder a