area51/Scripts/BuildApps.pl
Andrew Sampson 431f72b93a source
2021-08-27 19:22:41 -07:00

34 lines
991 B
Perl

use strict;
use Win32::NetAdmin;
use Net::SMTP;
# ------------------------------------------------------------------------
# main
# ------------------------------------------------------------------------
# Read user name from environment
my $username = $ENV{"USERNAME"};
if( !defined( $username ) )
{
die "Could not determine USERNAME from environment\n";
}
# Read build script
open( FILE, "< BuildScript.txt" ) || die "Can't open BuildScript\n";
my @script = <FILE>;
close FILE;
my $script = join( "", @script );
# Setup the email
my $from = "$username\@inevitable.com";
my @recip_list = ('build@a51apps-01');
my $smtp_host = "a51apps-01";
my $smtp = Net::SMTP->new($smtp_host, Timeout => 30) || die "Can't connect to $smtp_host.\n";
$smtp->mail ( $from ) || die "cannot mail from.\n\n";
$smtp->recipient( @recip_list );
$smtp->data ( );
$smtp->datasend ( "To:\tBuild\n" );
$smtp->datasend ( "Subject:\tBuild\n" );
$smtp->datasend ( $script );
$smtp->dataend;
$smtp->quit;