Perl Example - Send using process Command

This Perl example shows how to send an email using the process command.
		
#!/usr/bin/perl -w
use strict;
use Win32::Process;

my ($processobj, $exitcode);
my $executable = 'NetMailBot.exe';
my $server = 'mail.domain.com';
my $from = 'to@domain.com';
my $to = 'from@domain.com';
my $subject = 'Test: Perl process Command';
my $body = "Test: Perl process Command";

my $Args = '-server ' . $server . 
                  ' -from ' . $from .
                  ' -to ' . $to . 
                  ' -subject ' . '"' . $subject . '"' . 
                  ' -body ' . '"' . $body . '"';

Win32::Process::Create( $processobj, $executable, $args, 0, CREATE_NEW_CONSOLE, "." );

if ($processobj) 
{
   print "Process started with PID ", $processobj->GetProcessID(), "\n";
   print "Process completed with exit code ", $processobj->GetExitCode( $exitcode ), "\n";
}
else 
{
   print "Unable to start process: ", Win32::FormatMessage( Win32::GetLastError() ), "\n";
}