Yeah i used ur coding below and i got the solution for my problem.

Thanks Aidan

Syed
----- Original Message -----
From: "Syed Ghouse" <[EMAIL PROTECTED]>
To: "php mailinglists" <[EMAIL PROTECTED]>
Sent: Wednesday, June 30, 2004 PM 04:45
Subject: Fw: [PHP] Re: Regular expression


>
> ----- Original Message -----
> From: "Syed Ghouse" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 30, 2004 PM 04:43
> Subject: Re: [PHP] Re: Regular expression
>
>
> > Thanks Aiden for ur help
> >
> > i used ur code and i got
> >
> > name as Red Wingate<[EMAIL PROTECTED]
> > and no email.
> >
> > So pls correct the code and send me such that i get name and email
> > separately.
> >
> > Regards
> > syed
> >
> > ----- Original Message -----
> > From: "Red Wingate" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 30, 2004 PM 04:27
> > Subject: [PHP] Re: Regular expression
> >
> >
> > > If you still like to gather the information without using any tools:
> > >
> > > $email = explode( "\n" , $mailText );
> > >
> > > foreach ( $email AS $emailLine ) {
> > >   $emailLine = trim( $emailLine );
> > >
> > >   if ( strtoupper ( substr( $emailLine , 0 , 4 ) ) == 'FROM' ) {
> > >     preg_match( '#^from\s*:\s*([^>]+)(<([^>]+)>)?#si' ,$emailLine
> > ,$parts );
> > >     break ;
> > >   }
> > > }
> > >
> > > $name  = $parts[1] ;
> > > $email = $parts[3] ;
> > >
> > > But you should consider the following:
> > >
> > > FROM: Red Wingate <[EMAIL PROTECTED]>
> > > FROM: Red Wingate
> > > FROM: [EMAIL PROTECTED]
> > >    .....
> > >
> > > Which makes working like this a pita.
> > >
> > >    -- red
> > >
> > > > I suggest not using a regex.
> > > >
> > > > There are better tools for parsing an email, for example "formail".
> > > >
> > > > $email = `formail -x Return-Path`;
> > > >
> > > > See google.com for more information
> > > >
> > > > Regards,
> > > > Aidan
> > > >
> > > >
> > > > "Syed Ghouse" <[EMAIL PROTECTED]> wrote in message
> > > > news:[EMAIL PROTECTED]
> > > > Hi All
> > > >
> > > > will anyone give me a solution to get the name and email address of
> > sender
> > > > from the mail text below using regular expression.
> > > >
> > > > The result shud get
> > > > name as syed ghouse
> > > > and
> > > > email as [EMAIL PROTECTED]
> > > >
> > > > --- Mail text start ---
> > > >
> > > > Return-Path: <[EMAIL PROTECTED]>
> > > > Delivered-To: [EMAIL PROTECTED]
> > > > Received: (qmail 25523 invoked by uid 508); 19 Jun 2004
06:23:25 -0000
> > > > Received: from localhost (HELO 192.168.90.8) (127.0.0.1)
> > > >   by mail.jinis.com with SMTP; 19 Jun 2004 06:23:25 -0000
> > > > Received: from 192.168.90.20 (proxying for 192.168.90.85)
> > > >         (SquirrelMail authenticated user [EMAIL PROTECTED])
> > > >         by 192.168.90.8 with HTTP;
> > > >         Sat, 19 Jun 2004 11:53:25 +0530 (IST)
> > > > Message-ID: <[EMAIL PROTECTED]>
> > > > Date: Sat, 19 Jun 2004 11:53:25 +0530 (IST)
> > > > Subject: test
> > > >
> > > > From : 'syed ghouse' <[EMAIL PROTECTED]>
> > > >
> > > > To: [EMAIL PROTECTED]
> > > > Cc: [EMAIL PROTECTED],[EMAIL PROTECTED]
> > > > User-Agent: SquirrelMail/1.4.2
> > > > MIME-Version: 1.0
> > > > Content-Type: text/plain;charset=iso-8859-1
> > > > Content-Transfer-Encoding: 8bit
> > > > X-Priority: 3
> > > > Importance: Normal
> > > >
> > > > test mail ignore
> > > >
> > > > --- Mail text end ---
> > > >
> > > >
> > > > Regards
> > > >
> > > > Syed
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to