Send mail : Mail « Network « Perl






Send mail

    

use Net::SMTP;

print "Content-type:text/html\n\n";

my $relay="relay.demo.net";
my $smtp="Net::SMTP->new($relay);

die "Could not open connection: $!" if (! defined $smtp);

$smtp->mail("Bate");
$smtp->to("admin@demo.net");
$smtp->data();
$smtp->datasend("To: admin@demo.net\n");
$smtp->datasend("From: admin@demo.net\n");
$smtp->datasend("Subject: Test1");
$smtp->datasend("\n");
$smtp->datasend("This is a test ...\n");
$smtp->dataend();
$smtp->quit;

print "Completed ...\n";

   
    
    
    
  








Related examples in the same category

1.use Mail::POP3Client to send an email out
2.Send email out
3.Send email out with SMTP
4.Sending mail with Net::SMTP on Windows
5.Get emails from server and save the emails to local drive
6.Open SENDMAIL