Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

########################################################################
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
#
# Module name   : jats_play_sendmail.pl
# Module type   : JATS Utility
# Compiler(s)   : Perl
# Environment(s): jats
#
# Description   : 
#
# Usage         : See POD at the end of this file
#
#......................................................................#

require 5.008_002;
use strict;
use warnings;

use Pod::Usage;
use Getopt::Long;
use LWP::UserAgent;
use HTTP::Request::Common 'POST';

use JatsError;
my $now = localtime;

#
#   Trap: This actually uses SEND mail to do the hard work
#         It won't work under windows, unless there is a send mail program available
#         Does explain how it determines the server under Unix
#


my $req = POST( 'mailto:dpurdie@vixtechnology.com',
    From         => 'buildadm@vixtechnology.com',
    #CC           => 'david@dpurdie.dyndns.org',
    To           => 'David.Purdie',
    Sender       => 'My.Test.Program',
    Date         => scalar localtime,
    Subject      => 'Test Message - ' . $now,
    Content_Type => qq(text/html),
    Content      => 'This is the body of the test message',
);

my $response = LWP::UserAgent->new->request($req);
if ($response->code != 202)
{
    print("BAD Send\n");
    #DebugDumpData("Response", \$response);
}
else
{
    print("Sent OK\n");
}