use Mime::Lite MIME::Lite->send('smtp', $mail_server_name_or_ip_address, TimeOut=>60); my $msg=MIME::Lite->new ( From=>"$from_name <$from_email_address>", To =>"$to_email_address", Subject=>"$subject_of_email", Type=>'text', Data=>$body_of_email ); $msg->send; #### use Net::SMTP my $smtp=Net::SMTP->new($mailserver_name_or_ip_address); $smtp->mail($from_address); $smtp->to($to_address); $smtp->data(); $smtp->datasend("To: $to_address\n"); $smtp->datasend("From: $from_address\n"); $smtp->datasend("Subject: $message_subject\n"); $smtp->datasend("\n$body_of_email\n"); $smtp->dataend(); $smtp->quit;