[TriLUG] automated mail via cron

William Sutton william at trilug.org
Mon Feb 21 11:17:59 EST 2005


You could try something with Perl and Net::SMTP.  (only catch is you have 
to install Net::SMTP if it isn't already on your system).  Try the 
following:

-----
use strict;
use Net::SMTP;

# fill these in to suit your purpose
my $mailServer = '';
my $mailTo     = '';
my $mailFrom   = '';
my $subject    = '';
my $message    = '';

my $smtp = Net::SMTP->new($mailServer, Timeout => 30);

unless ($smtp)
{

    # maybe you want to log that you couldn't connect here
    exit;
}

$smtp->to($mailTo);
$smtp->data();
$smtp->datasend("Subject:$subject\n");
$smtp->datasend("To: $mailTo \n");
$smtp->datasend("From: $mailFrom\n");
$smtp->datasend("\n");
$smtp->datasend("$message\n");
$smtp->datasend(".");
$smtp->dataend();
$smtp->quit;
-----

HTH

William

On Mon, 21 Feb 2005, Wing D Lizard wrote:

> I'd like to send myself an email message ( 'update your timecard,
> slacker') via a cron job.
> 
> 
> Can I do this without setting up sendmail?  Is there a
> simple package that will send mail to my roadrunner smtp
> server?
> 
> Thanks.
>> 
> 
> 
> 
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 2/18/2005
> 
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> 
> 




More information about the TriLUG mailing list