# test e-mail june 2015 use strict; use warnings; use Net::SMTP; use Authen::SASL; my ($host_em, $to_em, $cc_em, $from_em, $subj_em, $data_em, %attach_em, $res_em, $err_em, $smtp); my ($full_host_name, $password_em, $username); my ($banner, $domain); $host_em = 'mail.btinternet.com'; $full_host_name = (gethostbyname $host_em)[0]; print "full_host_name <$full_host_name>\n"; $from_em = 'valid e-mail address'; $cc_em = 'valid e-mail address'; $to_em = 'valid e-mail address'; $password_em = 'password for $from_em'; $subj_em = 'Test e-mail'; $data_em = 'Please let me know if this arrives'; $smtp = Net::SMTP->new($host_em, Debug => 1); print "\nsmtp <$smtp>\n"; $smtp->auth ($from_em, $password_em); print "\nbefore ->mail\n"; $smtp->mail ($from_em); print "\nbefore ->to\n"; $smtp->to($to_em); print "\nbefore ->data\n"; $smtp->data; $smtp->datasend("From: " . $from_em); $smtp->datasend("To: " . $to_em); $smtp->datasend('Subject: This is a test'); $smtp->datasend("\n"); $smtp->datasend("$data_em"); $smtp->dataend; $smtp->quit; $banner = $smtp->banner; print "\nbanner <$banner>\n"; $domain = $smtp->domain; print "\ndomain <$domain>\n";