Where's the part where it puts into a DB on a single row?  C'mon Joe...

 ;-)

Al 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Tuesday, June 22, 2004 2:31 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] OT: Exchange accounting

Yuck that output came through looking pretty nasty... Try this instead...


[Tue 06/22/2004 14:24:35.83]
G:\TEMP\delete>pop 2k3exc01.joe.com joe joemamma Enumerating...
Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: RE: End of the world as we know it....

Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: RE: Contact Info - Joe Richards

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110976]: Email broken yet again

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110977]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110981]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: <[EMAIL PROTECTED]>
Subject: GLOBAT SUCKS

Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: Web form for globat support to automate tickets

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110976]: Email broken yet again

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110977]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110981]: Email broken




And for the other




[Tue 06/22/2004 14:25:53.87]
G:\TEMP\delete>notepad pop2.pl

[Tue 06/22/2004 14:27:57.29]
G:\TEMP\delete>pop2 2k3exc01.joe.com joe joemamma Enumerating...
Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: RE: End of the world as we know it....

Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: RE: Contact Info - Joe Richards

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110976]: Email broken yet again

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110977]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110981]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: <[EMAIL PROTECTED]>
Subject: GLOBAT SUCKS

Message-Id: <[EMAIL PROTECTED]>
From: "joe" <[EMAIL PROTECTED]>
Subject: Web form for globat support to automate tickets

Message-Id: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: failure notice

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110976]: Email broken yet again

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110977]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110981]: Email broken



[Tue 06/22/2004 14:28:16.76]
G:\TEMP\delete>pop2 2k3exc01.joe.com joe joemamma
[EMAIL PROTECTED] Enumerating...
Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110977]: Email broken

Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
Subject: [Support #110981]: Email broken


[Tue 06/22/2004 14:28:23.04]
G:\TEMP\delete>










-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Tuesday, June 22, 2004 2:10 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] OT: Exchange accounting

I may be going about this a little simply but I would set up a perl script
that runs daily from scheduled tasks that uses POP3 or IMAP to read the
messages and populate a text file or access database or SQL Database (MySql,
SQL Server, etc). 

Here is a quick example of reading POP3 mailbox and outputting the message
info from perl...


use Net::POP3;

$host=shift     || "servername";
$username=shift || "username";
$password=shift || "password";


$pop=Net::POP3->new($host) or die("Error: Couldn't connect to $host -
$!\n");


$msgs=$pop->login($username, $password); if ($msgs!=undef)  {
  print "Enumerating...\n";
  my $msgnums = $pop->list;
  foreach my $msgnum (sort {$a<=>$b} keys %$msgnums) 
   {
    $msg=$pop->top($msgnum,0);
    chomp @$msg;
    ($from)=grep(/from: /i,@$msg);
    ($subject)=grep(/subject: /i,@$msg);
    ($messageid)=grep(/message-id: /i,@$msg);
    print "$messageid;$from;$subject\n";
   }
  $pop->quit();
 }
else
 {
  print "Logon failed\n";
 }


You can pull out dupe message IDs either when putting the info into the
storage medium or later when making the report since most likely the old
messages won't be deleted on each new pass. You could even adust the script
to just track message header of last message read and then loop through
messages until that message is encountered and then count the messages after
that ID and then the last message read would have its ID saved for the next
pass, etc etc... 



Output would look something like:

[Tue 06/22/2004 13:42:56.84]
G:\TEMP\delete>pop 2k3exc01.joe.com joe pokeyjoe Enumerating...
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: RE: End of the world as we know it....
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: RE: Contact Info - Joe Richards
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110976]: Email broken yet again
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110977]: Email broken
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110981]: Email broken
Message-ID:
<[EMAIL PROTECTED]>;From:
<[EMAIL PROTECTED]>;Subject: GLOBAT SUCKS
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: Web form for globat support to automate
tickets
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110976]: Email broken yet again
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110977]: Email broken
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110981]: Email broken

[Tue 06/22/2004 13:43:29.66]
G:\TEMP\delete>




Here would be an example of filtering on last message ID seen...


use Net::POP3;


$host=shift     || "servername";
$username=shift || "username";
$password=shift || "password";
$lastmess=lc(shift);

$pop=Net::POP3->new($host) or die("Error: Couldn't connect to $host -
$!\n");


$msgs=$pop->login($username, $password); if ($msgs!=undef)  {
  print "Enumerating...\n";
  my $msgnums = $pop->list;
  if (!$lastmess) {$newmessages=1} else {$newmessages=0};
  foreach my $msgnum (sort {$a<=>$b} keys %$msgnums) 
   {
    $msg=$pop->top($msgnum,0);
    chomp @$msg;
    ($from)=grep(/from: /i,@$msg);
    ($subject)=grep(/subject: /i,@$msg);
    ($messageid)=grep(/message-id: /i,@$msg);
    if (!$newmessages)
     {
      ($msgid)=($messageid=~/\<(.+?)\>/);
      $msgid=lc($msgid);
      if ($msgid eq $lastmess) {$newmessages=1};
      next;
     }    
    print "$messageid;$from;$subject\n";
   }
  $pop->quit();
 }
else
 {
  print "Logon failed\n";
 }




Output


[Tue 06/22/2004 14:05:10.54]
G:\TEMP\delete>pop2 2k3exc01.joe.com joe pokeyjoe Enumerating...
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: RE: End of the world as we know it....
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: RE: Contact Info - Joe Richards
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110976]: Email broken yet again
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110977]: Email broken
Message-ID: <[EMAIL PROTECTED]>;From: [EMAIL PROTECTED];Subject:
[Support #110981]: Email broken
Message-ID:
<[EMAIL PROTECTED]>;From:
<[EMAIL PROTECTED]>;Subject: GLOBAT SUCKS
Message-Id: <[EMAIL PROTECTED]>;From:
"joe" <[EMAIL PROTECTED]>;Subject: Web form for globat support to automate
tickets
Message-Id: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: failure notice
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110976]: Email broken yet again
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110977]: Email broken
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110981]: Email broken

[Tue 06/22/2004 14:06:31.95]
G:\TEMP\delete>pop2 2k3exc01.joe.com joe pokeyjoe
[EMAIL PROTECTED] Enumerating...
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110977]: Email broken
Message-ID: <[EMAIL PROTECTED]>;From:
[EMAIL PROTECTED];Subject: [Support #110981]: Email broken

[Tue 06/22/2004 14:06:42.27]
G:\TEMP\delete>



   joe



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Hunter, Laura E.
Sent: Tuesday, June 22, 2004 10:55 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] OT: Exchange accounting

Morning all,

Okay, here's the situation ("my parents went away on a..." Stoppit, Laura,
you're having an '80s flashback):

I have an Exchange 2000 mailbox set up as a drop-box for general customer
service support inquiries for my office.  The manager of the CS area wants
to keep track of how many messages are sent to the drop-box so that she can
have a pretty chart to show off at Senior Staff meetings.  :-)  The solution
that's currently in place is this:  every message that comes into the
drop-box is copied into a "Statistics"
sub-folder.  The messages in the Inbox are forwarded/replied to/deleted as
necessary, and the CS manager exports the ~\Statistics folder to an Excel
spreadsheet or some such.

This strikes me as being a really kludgey solution, since every 6 months or
so I need to call her with "You know, there are like 30,000 messages in the
Statistics folder, you might want to think about deleting them if you've
captured the information you need."

Is there something script-y that I can do that will...(this is my idea, but
I'm open to suggestions)...add a record to a SQL table every time a message
hits the Inbox?  That way the metadata is captured in a way that's conducive
to searching/querying/reporting, and is a lot more elegant than what's
currently happening.

I'm not a script-maven by any stretch, so if there were even some
Shake-n-Bake code out there that I could start with (from Robbie or
someone), that would make me quite the happy network admin.

("Laura, learn how to do scripting, it'll make you a much better admin."
I know, I know, it's on my list.)

*********************************************
Laura E. Hunter
MCT, MCSE: Security, MVP - Windows Networking Senior IT Specialist
University of Pennsylvania
********************************************
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information.  Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email, destroy all copies of
the original message, and repent!  Repent!

  
Any views expressed in this email message, well-informed and intellectually
unassailable as they may be, are those of the individual sender except where
the sender specifically states them to be the views of Student Financial
Services.


List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to