Re: [PHP] real simple regex

2001-09-18 Thread Frank M. Kromann

The imap_mail() function connects to a SMTP the same way mail() does. It just takes a 
few paremeters more allowing you to set Reply-To and other headers normaly defined in 
PHP.INI.

In general the imap functions can be used with IMAP¤ and POP3 servers to read mails.

- Frank

> but can imap replace my old mail() calls? Don't I have to get a server that 
> supports it or something??
> 
> the regex thing I already got working...
> 
> thanks...
> 
> At 21:53 17/9/2001 -0700, Frank M. Kromann wrote:
> >Take a look at http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php
> >
> >This function will do the trick. You can also have a look at 
> >http://php.net/manual/en/function.imap-mail.php. This is an extended mail 
> >function and it works on both WIndows and *nix.
> >
> >- Frank
> >
> > > I had to write my own mail() function cuz PHP's does not work in Windows
> > > very well..
> > >
> > > But I suck at regex and I need to get the email address from the field 
> > from
> > > that can be something like:
> > > $from = "Christian Dechery <[EMAIL PROTECTED]>";
> > >
> > > so what I want is:
> > > the string between '<' and '>' or the last 'word' of the 'sentence' (for
> > > something like "\"Christian Dechery\" [EMAIL PROTECTED]").
> > >
> > > thanks...
> > >
> > > p.s: meu novo email é [EMAIL PROTECTED]
> > > 
> > > . Christian Dechery (lemming)
> > > . http://www.tanamesa.com.br
> > > . Gaita-L Owner / Web Developer
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> 
> 
> _
> . Christian Dechery
> . . Gaita-L Owner / Web Developer
> . . http://www.webstyle.com.br
> . . http://www.tanamesa.com.br
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] real simple regex

2001-09-18 Thread Christian Dechery

but can imap replace my old mail() calls? Don't I have to get a server that 
supports it or something??

the regex thing I already got working...

thanks...

At 21:53 17/9/2001 -0700, Frank M. Kromann wrote:
>Take a look at http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php
>
>This function will do the trick. You can also have a look at 
>http://php.net/manual/en/function.imap-mail.php. This is an extended mail 
>function and it works on both WIndows and *nix.
>
>- Frank
>
> > I had to write my own mail() function cuz PHP's does not work in Windows
> > very well..
> >
> > But I suck at regex and I need to get the email address from the field 
> from
> > that can be something like:
> > $from = "Christian Dechery <[EMAIL PROTECTED]>";
> >
> > so what I want is:
> > the string between '<' and '>' or the last 'word' of the 'sentence' (for
> > something like "\"Christian Dechery\" [EMAIL PROTECTED]").
> >
> > thanks...
> >
> > p.s: meu novo email é [EMAIL PROTECTED]
> > 
> > . Christian Dechery (lemming)
> > . http://www.tanamesa.com.br
> > . Gaita-L Owner / Web Developer
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] real simple regex

2001-09-18 Thread


From: Jack Dempsey <[EMAIL PROTECTED]>
Date: Mon, Sep 17, 2001 at 09:41:07PM -0400
Message-ID: <[EMAIL PROTECTED]>
Subject: RE: [PHP] real simple regex

> you actually don't need regex...
> if you take a few minutes you can do it all with strpos and substr, adn
> it'll be faster than regex.





Not realy the very best solution to use strpos and substr. You'll
have to loop through the "From-string" and look for the next address
each time. You can have more than one address in the From-field! And
then again... what would you do with addresses that are not between
< and >? Eg.: Renze Munnik <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Using strpos and substr won't realy make you're live any simpler.

I suggest you use something like the following RE:
$emlchars = "[a-z0-9.-]+";
$RE = "/($emlchars@$emlchars)/i";

I've put the allowed characters for the email-address in a separate
string in order to make it read easier. You can add all characters
to that string that are also allowed, because I don't believe these
are the only allowed characters in an email-address.
How to use? See the following example code:

--- PHP Code ---

,
 [EMAIL PROTECTED],
 Mr Nobody <[EMAIL PROTECTED]>";
$emlchars = "[a-z0-9.-]+";
$RE = "/($emlchars@$emlchars)/i";

if (preg_match_all ($RE, $from, $matches)) {
  print ("Matched!\n\n");
  print_r ($matches);
} else {
  print ("Didn't match!");
}

?>

--- End of PHP Code ---



-- 

* R&zE:


-- 
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] real simple regex

2001-09-17 Thread Frank M. Kromann

Take a look at http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php

This function will do the trick. You can also have a look at 
http://php.net/manual/en/function.imap-mail.php. This is an extended mail function and 
it works on both WIndows and *nix.

- Frank

> I had to write my own mail() function cuz PHP's does not work in Windows 
> very well..
> 
> But I suck at regex and I need to get the email address from the field from 
> that can be something like:
> $from = "Christian Dechery <[EMAIL PROTECTED]>";
> 
> so what I want is:
> the string between '<' and '>' or the last 'word' of the 'sentence' (for 
> something like "\"Christian Dechery\" [EMAIL PROTECTED]").
> 
> thanks...
> 
> p.s: meu novo email é [EMAIL PROTECTED]
> 
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] real simple regex

2001-09-17 Thread Jack Dempsey

you actually don't need regex...
if you take a few minutes you can do it all with strpos and substr, adn
it'll be faster than regex.

-Original Message-
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 11, 2001 9:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP] real simple regex


I had to write my own mail() function cuz PHP's does not work in Windows
very well..

But I suck at regex and I need to get the email address from the field from
that can be something like:
$from = "Christian Dechery <[EMAIL PROTECTED]>";

so what I want is:
the string between '<' and '>' or the last 'word' of the 'sentence' (for
something like "\"Christian Dechery\" [EMAIL PROTECTED]").

thanks...

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]