#!/bin/perl5 -w # $Id: mailsend,v 1.1 1999/10/28 19:04:56 annis Exp $ # $Source: /u/annis/uw-unix/perltut/RCS/mailsend,v $ # # A template example of sending email via the SMTP module. use Net::SMTP; use strict; # ADD ERROR CHECKING... # I have omitted error checking on all of these calls to save space on # the slide. You should check them, though. my $smtp = Net::SMTP->new('mailhost.biostat.wisc.edu'); $smtp->mail('nobody'); $smtp->to('annis'); $smtp->data(); # Start the message $smtp->datasend("To: annis\n"); $smtp->datasend("Subject: a test"); $smtp->datasend("\n"); $smtp->datasend("This is a test message.\n"); $smtp->dataend(); $smtp->quit() # EOF