Tuesday, April 17, 2012

Oracle Applications Technical

#!/usr/bin/perl -w
# ==========================================================================+
# Copyright (c)
# All rights reserved.
#
# ==========================================================================+
#
# PROGRAM NAME: XXXPOEPDF.pl
#
# PURPOSE : Script for sending PDF email to suppliers using unix sendmail program
#
#
# HISTORY :
#
# COMMENT : For more details refer report technical specifications in XXX version change control
#
#
# ==========================================================================
#
#
#
# Load module
#
use Net::SMTP;
use MIME::Lite;
#
# Declaring variables
#
$to="$ARGV[0]";
$from="$ARGV[2]";
$cc="$ARGV[3]";
$file_path="$ENV{'APPLCSF'}/$ENV{'APPLOUT'}/$ARGV[4]";
$file_name="$ARGV[7].pdf";
$subject="$ARGV[5]";
$text_body="$ARGV[6]\n\n";
#
# create the multipart container
#
$msg = MIME::Lite-> new (
From => $from,
To => $to,
Cc => $cc,
Subject => $subject,
Type => 'multipart/mixed'
) or die "Error creating multipart container: $!\n";
#
# Add the text message part
#
$msg->attach (
Type => 'TEXT',
Data => $text_body
) or die "Error adding the text message part: $!\n";
#
# Add the pdf file
#
$msg->attach (
Type => 'application/pdf',
Path => $file_path,
Filename => $file_name,
Disposition => 'attachment'
) or die "Error adding $file_name: $!\n";
#
# Send the Message
#
MIME::Lite->send('smtp', 'mailhost', Timeout=>60);
$msg->send;

No comments:

Post a Comment