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

breno breno at rio.pm.org
Mon Apr 9 22:00:24 PDT 2012


Eu gosto do Net::SMTP, mas ele pode ser muito baixo nível para algumas
pessoas. Hoje costumo sugerir o Email::Sender como alternativa mais
robusta.

Mais informações:

    https://metacpan.org/module/Email::Sender::Manual::QuickStart
    https://metacpan.org/module/Email::Sender::Transport::SMTP::TLS

[]s

-b

On Tue, Apr 10, 2012 at 12:02 AM, Felipe Leprevost
<leprevostfv at gmail.com> wrote:
>
>
> 2012/4/8 Renato Santos <renato.cron at gmail.com>
>>
>> ok,
>>
>> então, acho que pra Gmail vc precisa usar o Net::SMTP::TLS
>>
>>
>> 2012/4/8 Guilherme Ferreira Silveira <gfsilveira at gmail.com>
>>>
>>> Não
>>>
>>>
>>> 2012/4/8 Renato Santos <renato.cron at gmail.com>
>>>>
>>>> Vc não usa essa senha não né?
>>>>
>>>> Em 08/04/2012 19:21, "Guilherme Ferreira Silveira"
>>>> <gfsilveira at gmail.com> escreveu:
>>>>>
>>>>> 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/
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Curitiba-pm mailing list
>>>>> Curitiba-pm at pm.org
>>>>> http://mail.pm.org/mailman/listinfo/curitiba-pm
>>>>>
>>>
>>>
>>>
>>> --
>>> 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/
>>>
>>
>>
>>
>> --
>> Saravá,
>> Renato CRON Santos
>> http://www.renatocron.com/blog/
>> @renato_cron
>>
>>
>>
>> _______________________________________________
>> Curitiba-pm mailing list
>> Curitiba-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/curitiba-pm
>>
>
> Guilherme, eu e o Newton a uns meses atrás andamos investigando uma forma de
> enviar emails através do Gmail. Nós acabamos utilizando o Net::SMTP::TLS
> (https://metacpan.org/module/Net::SMTP::TLS) como o cron falou. A
> configuração dele é bem simples, tente utilizá-lo, qualquer coisa é só dar
> um grito ae.
>
> abraços.
>
>
> --
> Felipe da Veiga Leprevost
> Bioinformatics & Computational Biology Laboratory
> Carlos Chagas Institute - ICC/FIOCRUZ
> Curitiba - PR - Brazil
>
>
> _______________________________________________
> Curitiba-pm mailing list
> Curitiba-pm at pm.org
> http://mail.pm.org/mailman/listinfo/curitiba-pm
>


More information about the Curitiba-pm mailing list