[Curitiba-pm] Enviar e-mail pelo perl.

Guilherme Ferreira Silveira gfsilveira at gmail.com
Sun Apr 8 15:21:47 PDT 2012


Caros boa noite.

Novamente venho a vocês para solicitar seus conhecimentos.

Estou tentando fazer um script para envio de e-mails no Win. Preciso
utilizar Win pois os usuários não estão familiarizados com Unix. O objetivo
do script, que aqui é mostrado apenas parcialmente, é após algumas
alterações de arquivo específico realizadas em perl, eu receber em meu
e-mail um relatório destas alterações.

Mando o código abaixo.

#!/Perl64/bin/perl –w
use strict;
use warnings;
use diagnostics;
use Carp;
use Net::SMTP;

my $alt = "Alteração realizada";
my $from = "emailfrom\@gmail.com";
my $to = "emailto\@gmail.br";
my $msg = $alt;
#my $tolist = $to;
#my $cclist = "";
#my $logstr = "";

my $smtp = Net::SMTP->new("smtp.gmail.com", Port=> 25, Timeout => 30, Debug
=> 1 );

$smtp->auth("DIGEST-MD5", "gfsilveira", "6relays6");# or CRAM-MD5
$smtp->mail($from);
$smtp->to($to);
$smtp->data($msg);
$smtp->datasend("testing the Net::SMTP mail\n");
$smtp->datasend("line 2\n");
$smtp->dataend();
$smtp->quit;
exit;

O problema ocorre quando eu rodo o script, e aparentemente ele não gera a
conexão necessário pelo SMTP. A mensagem de erro que recebo é:

Can't call method "auth" on an undefined value at Test_mail.pl.

Testei alguns outros códigos usando Net::SMTP_auth, ou
MIME::Lite::TT::HTML, para html, mas a mensagem é a mesma.;

Agradeço caso alguém possa me dar alguma ajuda.

Guilherme.


-- 
Guilherme Ferreira Silveira, BMD, MSc.
PhD's Student
Bioscience and Biotechnology
Carlos Chagas Institute/FIOCRUZ
Rua Prof Algacyr Munhoz Máder 3775
81350-010, Curitiba, Paraná, Brazil.
tel: +55 41 21043330
fax: +55 41 21043267
e-mail: gfsilveira at gmail.com
skype: g.fsilveira
\w/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/curitiba-pm/attachments/20120408/1e88b59c/attachment.html>


More information about the Curitiba-pm mailing list