use strict; use warnings; use MIME::Entity; my $From = ''; my $To = ''; my $Subject = 'Test'; my $Type = 'text/plain'; my $Host = 'mail.btinternet.com'; my $msg = MIME::Entity->build( From => $From, To => $To, Subject => $Subject, Type => $Type, Data => 'This is a test message', Debug => 1 ); print "\nbefore smtpsend\n\n"; my @ok = $msg->smtpsend( Host => $Host, To => $To, Debug => 1 ); if (@ok) { print "Sent message to: ", join(', ', @ok), "\n"; } else { print "\nFailed to send message"; }