Using one of the messages as a sample (This is the third message from the __DATA__ section) before and after this is what I am trying to accomplish.#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $lineBufferStatus = 0; my @rcptBuffer = (); my @linesBuffer = (); my $msgUpdateCnt = 0; while (<DATA>) { if ( $_ =~ /^DATA(?:\n|\r\n)$/ ) { print "In second If statement DATA if statement\n"; @linesBuffer = (); $lineBufferStatus = 0; } elsif ( $_ =~ /^\.(?:\n|\r\n)$/ ) { if ( int(@linesBuffer) > 0 ) { while( int(@linesBuffer) > 0 ) { print shift(@linesBuffer); } print "\r\n.\r\nQUIT\r\n"; $msgUpdateCnt++; } $lineBufferStatus = 1; } elsif ( $lineBufferStatus == 0 ) { push( @linesBuffer, $_ ); } } if ( int(@linesBuffer) > 0 ) { my $perMsgRcptBufCnt = 0; while( int(@linesBuffer) > 0 ) { print shift(@linesBuffer); } print "\r\n.\r\nQUIT\r\n"; $msgUpdateCnt++; } if ( $msgUpdateCnt == 1 ) { print "---------------------EQUALS 1--------------------\n"; } elsif ( $msgUpdateCnt > 1 ) { print "---------------------EQUALS 2--------------------\n"; } __DATA__ EHLO testdomain.com MAIL FROM:<outsideuser01@outdomain.com> SIZE=1016 BODY=7BIT RCPT TO:<testuser01@testdomain.com> RCPT TO:<testuser02@testdomain.com> DATA Received: from 1.1.1.1(helo=mvastnlufgt.mgrjofpxydauvu.info) by with esmtpa (Exim 4.69) (envelope-from ) id 1MM6HB-1114fm-3T for testuser01@testdomain.com; Sun, 9 Jan 2011 23:07:59 +0100 From: "outsideuser01" <outsideuser01@outdomain.com> To: <testuser01@testdomain.com> Subject: Re: good evening Date: Sun, 9 Jan 2011 23:07:59 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_ppstll_21_19_24" X-Priority: 3 X-Mailer: choakmps.33 Message-ID: <5C74A867.4001970@aclighting.com> ------=_ppstll_21_19_24 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable H i website: http://canadianph +.tz= hzvebp.ajwcd.ru - CanadianPharmacy ------=_ppstll_21_19_24 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-88 +59-= 1"> <STYLE></STYLE> </HEAD> <BODY> H i <br> website: http://canadianph.tzhzvebp.ajwcd.ru - CanadianPharmacy + = </BODY></HTML> ------=_ppstll_21_19_24-- . RSET MAIL FROM:<Megan@bankofdeerfield.com> SIZE=1016 BODY=7BIT RCPT TO:<testuser36@testdomain.com> RCPT TO:<testuser22@testdomain.com> RCPT TO:<testuser99@testdomain.com> DATA Received: from mdmcfntioehaoqtcmjdmjmcm (192.168.1.33) by wonderware.c +om (80.149.49.194) with Microsoft SMTP Server id 8.0.685.24; Sun, 9 J +an 2011 23:08:07 +0100 Message-ID: <4D2A2627.204070@pacunion.com> Date: Sun, 9 Jan 2011 23:08:07 +0100 From: "Megan" <Megan@bankofdeerfield.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9 +) Gecko/20100921 Thunderbird/3.1.4 MIME-Version: 1.0 To: <testuser36@testdomain.com> Subject: good morning Content-Type: multipart/alternative; boundary="------------02070800106050608090806" X-Priority: 3 X-Mailer: choakmps.33 Message-ID: <5C74A867.4001970@aclighting.com> ------=_ppstll_21_19_24 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi website: http://canadianp= kerur.ru - CanadianPharmacy ------=_ppstll_21_19_24 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-88 +59-= 1"> <STYLE></STYLE> </HEAD> <BODY> H i <br> website: http://canadianp.kerur.ru - GermanPharmacy = </BODY></HTML> ------=_ppstll_21_19_24-- . RSET MAIL FROM:<robertson@roberts.com> SIZE=9916 BODY=7BIT RCPT TO:<testuser2937@testdomain.com> RCPT TO:<testuser22@testdomain.com> DATA Received: from testdomains (172.12.223.44) by wonderware.com (32.34.49 +.194) with Microsoft 23:08:07 +0100 Message-ID: <4D2A2627.204070@pacunion.com> Date: Sat, 8 Jan 2011 17:18:27 +0100 From: "Megan" <robertson@roberts.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9 +) Gecko/20100921 Thunderbird/3.1.4 MIME-Version: 1.0 To: <testuser2937@testdomain.com> Subject: morning Content-Type: multipart/alternative; boundary="------------02070800106050608090806" X-Priority: 3 X-Mailer: choakmps.33 Message-ID: <5C74A867.4001970@aclighting.com> ------=_ppstll_21_19_24 Content-Type: text/plain; . RSET
--------THIS IS THE CURRENT OUTPUT-------- Received: from testdomains (172.12.223.44) by wonderware.com (32.34.49 +.194) with Microsoft 23:08:07 +0100 Message-ID: <4D2A2627.204070@pacunion.com> Date: Sat, 8 Jan 2011 17:18:27 +0100 From: "Megan" <robertson@roberts.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9 +) Gecko/20100921 Thunderbird/3.1.4 MIME-Version: 1.0 To: <testuser2937testdomain.com> --------THIS IS THE DESIRED OUTPUT ( I have captured both RCPT TO: lin +es and appended them after the Original To:)-------- Received: from testdomains (172.12.223.44) by wonderware.com (32.34.49 +.194) with Microsoft 23:08:07 +0100 Message-ID: <4D2A2627.204070@pacunion.com> Date: Sat, 8 Jan 2011 17:18:27 +0100 From: "Megan" <robertson@roberts.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9 +) Gecko/20100921 Thunderbird/3.1.4 MIME-Version: 1.0 To: <testuser2937@testdomain.com> To: <testuser2937@testdomain.com> To: <testuser22@testdomain.com>
In reply to Help appending data based on location by perlnewbie9292
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |