// Language: Perl
#!/usr/bin/perl
use strict;
use warnings;
use Net::SMTP;
my $smtp = Net::SMTP->new('smtp.example.com', Port => 25, Timeout => 30)
or die "SMTP connect failed: $!";
$smtp->mail('from@example.com');
$smtp->to('to@example.com');
$smtp->data();
$smtp->datasend("Subject: Hello\n\nGreetings from Perl.\n");
$smtp->dataend();
$smtp->quit;