| 
                                                             Wednesday 31 October 2007 8:00:49 am 
                                                            
                                                            
                                                                 Anthony, I just encountered the same problem in EZP 3.10.0 and OE 4.2.4.  Here's what I did to solve the problem: 1. I searched all the files in my EZP installation for the string "Invalid e-mail address." This returned 2 results: 
a. /extension/ezdhtml/ezxmltext/handlers/input/ezdhtmlinputparser.php b. /kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php 2. This error is generated if this validation step fails:         
include_once( 'lib/ezutils/classes/ezmail.php' );
if ( !eZMail::validateMail( $mailAddr[1] ) )
{
...
}
    3. In the file "/lib/ezutils/classes/ezmail.php," there is a regular expression for email address validation (I've broken it out of serveral lines for readability):         
define( 'EZ_MAIL_REGEXP', 
'(
[0-9a-zA-Z]
([-.\w]*
[0-9a-zA-Z_])*
@
(((
([0-9a-zA-Z])+
([-\w]*
[0-9a-zA-Z])*
\.
)
+
[a-zA-Z]{2,9})|
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))
' );
    4. That expression does not accommodate a query string on the end because it is used to validate email addresses, not mailto: links. I created another regular expression and function for mailto: validation. 5. The new regular expression is in "/lib/ezutils/classes/ezmail.php" is:         
define( 'EZ_MAILTO_REGEXP', 
'(
[0-9a-zA-Z]
([-.\w]*
[0-9a-zA-Z_])*
@
(((
([0-9a-zA-Z])+
([-\w]*
[0-9a-zA-Z])*
\.
)
+
[a-zA-Z]{2,9})|
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.
(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))
(\?[a-zA-Z0-9=]*)?((&[a-zA-Z0-9=]*))*))
' );
    The last part...         
(\?[a-zA-Z0-9=]*)?((&[a-zA-Z0-9=]*))*)
 
    ...seems to accommodate for strings <i>starting with a question mark, followed by 0..n occurences of alphanumeric characters and an equal sign, followed by 0..n occurrences of a pattern that starts with an ampersand, followed by 0..n occurrences of an alphanumeric pattern and an equal sign</i>. I stress the word seems, because I don't write regular expressions very often. It's not perfect, but it works for simple cases. And it gives false positives, but I can live with that for now. 6. I also created a function in '/lib/ezutils/classes/ezmail.php" called validateMailto:         
function validateMailto( $address )
{
//$pos = ( ereg( '^' . EZ_MAILTO_REGEXP . '$', $address) );
$pos = ereg(EZ_MAILTO_REGEXP, $address);
return $pos;
}
    Again, probably not perfect, but it's working so far. 7. In the other two files mentioned in step 1 above, I changed the call to read as such:         
include_once( 'lib/ezutils/classes/ezmail.php' );
if ( !eZMail::validateMailto( $mailAddr[1] ) )
{
...
}
    So far this is working, but I'm sure it will fail on same cases and should be reviewed and improved.  Anyway, I hope people find this hack useful... -Luke 
PS: I've also reported a bug: http://issues.ez.no/IssueView.php?Id=11798                                                             
                                                                                                                                                                                 |