#!perl -w use strict; use Mail::SendMail; my($LocalFile) = 'c:\users\alan\netscape\bookmark.htm'; my($RemoteEmail) = 'YOUR_EMAIL@ADDRESS.GOES.HERE.EXAMPLE.COM'; my($LocalEmail) = 'FileFlinger '; my($Subject) = 'AutoMagical Bookmark Updater'; my($MaxRetries) = 6; # Try 10 times max. my($RetryDelay) = 60; # Try every minute. my($PGPSign) = 'c:\progra~1\pgp50\pgps -a -u "KEY NAME HERE " -o'; my($TempSignFile) = 'C:\aaafling.tmp'; my($Password) = 'PASSWORD'; my($DEBUG) = 1; main(); #============================================================================= sub main { DebugMessage("Starting\n"); $ENV{'PGPPASSFD'} = "0"; if(-e $TempSignFile) { DebugMessage("Removing old '$TempSignFile'\n"); unlink $TempSignFile; } DebugMessage("Attempting encryption\n"); open(PGPSIGN, "|$PGPSign $TempSignFile $LocalFile"); print PGPSIGN "$Password\n"; close(PGPSIGN); DebugMessage("Encryption done.\n"); DebugMessage("Reading encrypted message\n"); open(FLING, $TempSignFile) or die "Unable to open local file '$LocalFile' because of '$!'\n"; my($SaveSep) = $/; $/ = undef; my($FileContents) = ; $/ = $SaveSep; close(FLING); DebugMessage("Message read.\n"); DebugMessage("Sending message\n"); my(%mail) = ( 'To' => $RemoteEmail, 'From' => $LocalEmail, 'Message' => $FileContents, 'Subject' => $Subject, ); if(Mail::Sendmail::sendmail(%mail)) { DebugMessage("Successful\n"); } else { print STDERR <<_EOERROR; An error occured: Sendmail reports: $Mail::Sendmail::error Generic reports: $! Log: $Mail::Sendmail::log _EOERROR } } sub DebugMessage() { if($DEBUG) { print @_; } }