Thursday, May 28, 2015

Sending mail with HTML content in PERL

Continue with my previous post, here you can find sending an email with HTML content in mail body.

use FileHandle;
my $con_email="out.html";
my $fh = new FileHandle(">$con_email") or die $!;
$fh->print("Content-Type: text/html\n");
my $to = '';
my $from = '';
my $replyto = '';
my $subject = 'Test Email';
my $message = 'Simple <a href="">script</a> to sending mail in perl.';
$fh->print("Reply-to: $replyto\n");
$fh->print("To: $to\n");
$fh->print("Cc: $to\n");
$fh->print("From: $from\n");
$fh->print("Subject: $subject \n\n");
system("/usr/lib/sendmail -t -oi < $con_email");
print "Email Sent Successfully\n";

Thats it..hope this will help you. Please comment here If you have any queries.


Saturday, May 23, 2015

Sendmail Utility: Sending mail in PERL

SendMail is a lightweight, command line SMTP email client. If you are using Linux/Unix machine then you can use sendmail utility inside your Perl program to send email.

Here you can find simple script to send an email  with using sendmail utility.

$to = '';
$from = '';
$subject = 'Sample Test Email';
$message = 'This is sample email for testing PERL script';

open(MAIL, "|/usr/sbin/sendmail -t");

# Email Header
 print MAIL "To: $to\n";
 print MAIL "From: $from\n";
 print MAIL "Subject: $subject\n\n";
# Email Body
 print MAIL $message;

 print "Email Sent Successfully\n";

Thats it..Hope this will help you.. :)


Thursday, May 7, 2015

Admrgpch Utility: Merge Patches using admrgpch

Admrgpch utility is used to merge multiple patches into a single one. This is useful when we have to apply many patches to reduce the patching time. This executable is located in AD_TOP/bin.

Consider below points for Admrgpch utility:

1) Admrgpch utility can't be used to merge patches of different releases, platforms or parallel modes.
2) AD patches and non AD patches can't be merged.
3) AD patches can be merged with other AD patches.
4) Merge any non-AD patch with any other non-AD patch.

Find below syntax to run AD merge patch:

admrgpch -s <merge_source> -d <merge_dest> -merge_name <mergename>

Here, create merge_source and merge_dest directories under /patch directory. Download the patches under /patch/merge_source directory. unzip those downloaded patches. In /patch/merge_dest directory will contains the merged patch driver file.


$ cd /patch
$ mkdir merge_source  merge_dest
$ ls
  merge_source  merge_dest
$ cd merge_source
Download the patches here
$ ls
 16759426  17385991

Now run the below command to merge the patches.

$ admrgpch -s /patch/merge_source -d /patch/merge_dest -merge_name merged_patch

Executing the merge of the patch drivers
 -- Processing patch: merge_source/16759426
 -- Processing file: merge_source/16759426/u16759426.drv
 -- Done processing file: merge_source/16759426/u16759426.drv
 -- Done processing patch: merge_source/16759426
 -- Processing patch: merge_source/17385991
 -- Processing file: merge_source/17385991/u17385991.drv
 -- Done processing file: merge_source/17385991/u17385991.drv
 -- Done processing patch: merge_source/17385991

Copying files...

5% complete. Copied 47 files of 925...
10% complete. Copied 93 files of 925...
Character-set converting files...
  2 unified drivers merged.
Patch merge completed successfully
Please check the log file at ./admrgpch.log.

Now we can see u_merged_patch.drv driver file under merge_dest folder.

$ cd merge_dest
$ ls u_merged_patch.drv

Now apply the merged patch as a single patch using adpatch.

Thats it..Hope this will help you.. :)