[BACK]Return to smtp.pm CVS log [TXT][DIR] Up to [local] / wpscripts / wpfreespace

File: [local] / wpscripts / wpfreespace / smtp.pm (download)

Revision 1.2, Wed Dec 21 09:36:14 2011 UTC (10 years, 7 months ago) by yason
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +4 -4 lines

update to current reality

package smtp;

use Net::SMTP;

our $SERVER	= "127.0.0.1";
our $HELLO	= "localhost";
our $SENDER 	= 'df@fullprint.ru';
our $FROM 	= "/bin/df";


sub email($$$)
{
    my $to = shift;
    my $volume = shift;
    my $used = shift;
    my $sv = new Net::SMTP( "$SERVER", Hello => "$HELLO", Debug => 0) or warn("Can't create SMTP object");
    
    $sv->mail($SENDER);
    $sv->to($to);
    
    $sv->data();
    $sv->datasend("From: $FROM\n");
    $sv->datasend("To: $to\n");
    $sv->datasend("Subject: *WARNING* Low free space on $volume ($used% used)!\n\n");
    $sv->dataend();
    
    $sv->quit();
    
}

return 1;