use strict; use MIME::Lite; use Getopt::Std; use MIME::Base64; use Authen::SASL; use Net::SMTP::SSL; use Net::SMTP::TLS; my $un='username@hotmail.com'; my $pw='passwords'; my $mh='smtp.live.com'; my $pt=25; my $from = 'username@hotmail.com'; my $to = 'touser@gmail.com'; my $mailer = new Net::SMTP::TLS( $mh, Port => $pt, User => $un, Password => $pw, Timeout => 60, ) or die "Cannot create a TLS mailer instance!\n"; $mailer->mail($from); $mailer->to($to); $mailer->data(); my $msg = MIME::Lite->new( From => $from, 'Reply-to' => $from, To => $to, Subject => "test", Type => 'multipart/related' ) or die "Cannot create a new email instance!\n"; $msg->attach( Type => 'TEXT', Data => "test messages", ) or die "Error adding TXT: $!\n"; $msg->attach( Type => 'aplication/pdf', Path => 'test.pdf', Disposition => 'attachment' ) or die "Error adding PDF: $!\n"; $mailer->datasend($msg->as_string); $mailer->dataend(); $mailer->quit();