use strict; use warnings; use FindBin; use Net::SMTP::TLS; use MIME::Lite; use lib ("$FindBin::Bin/CPAN"); my $msg = MIME::Lite->new( From => 'me@gmail.com', To => 'you@gmail.com', Subject => 'A message with 2 parts...', Type => 'multipart/mixed', ); #$msg->attach( # Type => 'TEXT', # Data => "Here's the GIF file you wanted", #); # $msg->attach( # Type => 'plain/txt', # Path => 'Log/output.log', # Filename => 'output.log', # ); my $mailer = new Net::SMTP::TLS( 'smtp.gmail.com', Hello => 'smtp.gmail.com', Port => 587, User => 'me@gmail.com', Password=> 'my-pwd'); $mailer->mail('me@gmail.com'); $mailer->to('you@gmail.com'); $mailer->data; $mailer->datasend($msg->as_string); $mailer->dataend; $mailer->quit;