[SP-pm] Imagem no corpo do e-mail

Otávio Fernandes otaviof at gmail.com
Tue Jan 26 04:58:33 PST 2010


2010/1/26 Guilherme Luis Eberhardt <guilherme.eberhardt em gmail.com>:
> Pessoal,
>
> Estou precisando enviar imagens no corpo do e-mail.
> Utilizo o módulo Mail::SendEasy mas poderia estar utilizando qualquer outro
> que atenda minha necessidade.
>
> Alguém possui alguma dica?
>
> Abraço!!!
>
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm

Guilherme,

Para esta tarefa eu costumo usar o MIME::Lite, veja um exemplo:

           ### Create a new multipart message:
           $msg = MIME::Lite->new(
               From    => 'me em myhost.com',
               To      => 'you em yourhost.com',
               Cc      => 'some em other.com, some em more.com',
               Subject => 'A message with 2 parts...',
               Type    => 'multipart/mixed'
           );

           ### Add parts (each "attach" has same arguments as "new"):
           $msg->attach(
               Type     => 'TEXT',
               Data     => "Here's the GIF file you wanted"
           );
           $msg->attach(
               Type     => 'image/gif',
               Path     => 'aaa000123.gif',
               Filename => 'logo.gif',
               Disposition => 'attachment'
           );
           ### use Net:SMTP to do the sending
           $msg->send('smtp','some.host', Debug=>1 );

Veja o restante aqui:
http://search.cpan.org/~rjbs/MIME-Lite-3.027/lib/MIME/Lite.pm

um abraço,

-- 
Otávio Fernandes <otaviof at gmail.com>
http://blog.emresumo.com


More information about the SaoPaulo-pm mailing list