#!/usr/bin/perl # # testSendMail.pl -- This is a simple example of using SendMail.pm module # to send a mail. # # Simon Tneoh Chee-Boon tneohcb@pc.jaring.my # # Copyright (c) 1998 Simon Tneoh Chee-Boon. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # # # Please refer to # http://www.tneoh.zoneit.com/perl/SendMail/ # for more information about SendMail.pm module. # use SendMail; # # Create the object without any arguments, # i.e. localhost is the default SMTP server. # $sm = new SendMail(); # # We set the debug mode "ON". # $sm->setDebug($sm->ON); # # We set the sender. # $sm->From("Your Name "); # # We set the subject. # $sm->Subject("test"); # # We set the recipient. # $sm->To("Recipient "); # # We set the content of the mail. # $sm->setMailBody("test data"); # # Check if the mail sent successfully or not. # if ($sm->sendMail() != 0) { print $sm->{'error'}."\n"; exit -1; } # # Mail sent successfully. # print "Done\n\n"; exit 0;