For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > April 2007 > Print Subject without characters Just Numbers using POP3Client. Please Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Print Subject without characters Just Numbers using POP3Client. Please Help
eng.john84@gmail.com

2007-04-11, 3:57 am

I`m using POP3Client,
I don`t need to print all subject i need to print just number.
i.e --> if Subject: John 1234567890, Then i need to print 1234567890


use Mail::POP3Client;


$pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
PASSWORD => "xxxxxxxxxx",
HOST => "xxxxxxxxxx" );

for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^(From|Subject):\s+/i and print $_, "\n";
}
print "\n";
sleep 5;
}

Sisyphus

2007-04-11, 3:57 am


<eng.john84@gmail.com> wrote in message
news:1176262038.155405.71070@y80g2000hsf.googlegroups.com...
> I`m using POP3Client,
> I don`t need to print all subject i need to print just number.
> i.e --> if Subject: John 1234567890, Then i need to print 1234567890
>


I don't understand - there is usually *no* number associated with the
Subject. At least that's the way it is for me when I run the script you
provided. Typical output is:

----------
From: =?ISO-8859-1?Q?D=E9cio_Luiz_Gazzoni_Filho?= <decio@dec.net>
Subject: Decimal arithmetic
----------

The only time I see numbers is when the person writing the email has
included numeric character(s) in the subject. eg:

----------
From: "mingw-gh3d-mailinglist@limco.pl" <mingw-gh3d-mailinglist@limco.pl>
Subject: [Mingw-users] mingw with g++ 4.x
----------

Cheers,
Rob

Sisyphus

2007-04-11, 3:57 am


<eng.john84@gmail.com> wrote in message
news:1176262038.155405.71070@y80g2000hsf.googlegroups.com...
> I`m using POP3Client,
> I don`t need to print all subject i need to print just number.
> i.e --> if Subject: John 1234567890, Then i need to print 1234567890
>


I don't understand - there is usually *no* number associated with the
Subject. At least that's the way it is for me when I run the script you
provided. Typical output is:

----------
From: =?ISO-8859-1?Q?D=E9cio_Luiz_Gazzoni_Filho?= <decio@dec.net>
Subject: Decimal arithmetic
----------

The only time I see numbers is when the person writing the email has
included numeric character(s) in the subject. eg:

----------
From: "mingw-gh3d-mailinglist@limco.pl" <mingw-gh3d-mailinglist@limco.pl>
Subject: [Mingw-users] mingw with g++ 4.x
----------

Cheers,
Rob

odhiseo

2007-04-12, 9:57 pm

On Apr 10, 10:51 pm, "Sisyphus" <sisyph...@nomail.afraid.org> wrote:
> <eng.joh...@gmail.com> wrote in message
>
> news:1176262038.155405.71070@y80g2000hsf.googlegroups.com...
>
>
> I don't understand - there is usually *no* number associated with the
> Subject. At least that's the way it is for me when I run the script you
> provided. Typical output is:
>
> ----------
> From: =?ISO-8859-1?Q?D=E9cio_Luiz_Gazzoni_Filho?= <d...@dec.net>
> Subject: Decimal arithmetic
> ----------
>
> The only time I see numbers is when the person writing the email has
> included numeric character(s) in the subject. eg:
>
> ----------
> From: "mingw-gh3d-mailingl...@limco.pl" <mingw-gh3d-mailingl...@limco.pl>
> Subject: [Mingw-users] mingw with g++ 4.x
> ----------
>
> Cheers,
> Rob



Maybe you want the Message-ID:

use Mail::POP3Client;

$pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
PASSWORD => "xxxxxxxxxx",
HOST => "xxxxxxxxxx" );

for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^(Message-ID):\s+/i && print $_, "\n";
}
print "\n";
sleep 5;
}

odhiseo

2007-04-12, 9:57 pm

On Apr 12, 8:47 pm, "odhiseo" <juli...@gmail.com> wrote:
> On Apr 10, 10:51 pm, "Sisyphus" <sisyph...@nomail.afraid.org> wrote:
>
>
>
>
>
>
>
>
>
>
>
> Maybe you want the Message-ID:
>
> use Mail::POP3Client;
>
> $pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
> PASSWORD => "xxxxxxxxxx",
> HOST => "xxxxxxxxxx" );
>
> for ($i = 1; $i <= $pop->Count(); $i++) {
> foreach ( $pop->Head( $i ) ) {
> /^(Message-ID):\s+/i && print $_, "\n";
> }
> print "\n";
> sleep 5;
> }


Sorry, now I understood your question

use Mail::POP3Client;

$pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
PASSWORD => "xxxxxxxxxx",
HOST => "xxxxxxxxxx" );

for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^Subject:\.+\s(\d+)/i && print $1, "\n";
}
print "\n";
sleep 5;
}

odhiseo

2007-04-13, 6:57 pm


> Sorry, now I understood your question
>
> use Mail::POP3Client;
>
> $pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
> PASSWORD => "xxxxxxxxxx",
> HOST => "xxxxxxxxxx" );
>
> for ($i = 1; $i <= $pop->Count(); $i++) {
> foreach ( $pop->Head( $i ) ) {


> /^Subject:\.+\s(\d+)/i && print $1, "\n";
> }
> print "\n";
> sleep 5;
> }- Hide quoted text -
>
> - Show quoted text -


Here is another way to do It (TMTOWTDI)


use Mail::POP3Client;

my $n = 10; #Length of number string in the subject


$pop = new Mail::POP3Client( USER => "xxxxxxxxxxxxxxxxx",
PASSWORD => "xxxxxxxxxx",
HOST => "xxxxxxxxxx" );

for ($i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {

next unless /^Subject:/;
/\s(\d{$n})(\s|$)/;
print $1;
}
print "\n";
sleep 5;
}

And in the previous reply I had a little error, you must change:
/^Subject:\.+\s(\d+)/i && print $1, "\n";
for:
/^Subject:.+\s(\d+)/i && print $1, "\n";


Ohhhh

2007-04-21, 3:09 pm

http://Halle-Berry-anal-action.org/...hp?movie=148803
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com