use strict; use warnings; use Net::SMTP; use MIME::Lite; my $smtp_server = 'mail.example.ch'; my $from = 'inlook@example.ch'; my $to = 'andre@example.ch'; my $pass = 'example'; my $smtp = Net::SMTP->new( "$smtp_server" , Timeout => 10 , Debug => 4 ) or die $!; $smtp->auth ( $from , $pass ) or die "Could not authenticate $!"; $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("From: $from\n"); $smtp->datasend("To: $to\n"); $smtp->datasend("Subject: test\n\n"); $smtp->datasend("test"); $smtp->dataend(); $smtp->quit; ### Create a new multipart message: my $msg = MIME::Lite->new( From => $from , To => $to , Subject => 'test', Data => "test" ); $msg->send( 'smtp' , $smtp_server , AuthUser=> $from , AuthPass=> $pass , Debug=>4 );