#! c:\perl\bin\perl.exe use strict; use warnings; use cgi; use Net::SMTP; #constants my $mailserver_url = "foo.bar.baz"; my $to = "foo\@bar"; my $from = "bar\@foo"; my $subject = "Mail time"; my $smtp = Net::SMTP->new('$mailserver_url'); #Sending the message $smtp->mail( $from ); $smtp->to( $to ); $smtp->data(); $smtp->datasend("To: $to\n"); $smtp->datasend("From: $from\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); # done with header $smtp->datasend($name, $company, $country, $email); $smtp->dataend(); $smtp->quit(); # all done. message sent.