Hi,
if this could be of some help, below is a php function I am used to work with (It should be easy to port to javascript) that makes mail address validation and handle this case (RFC2822 compliant) :
<?php
// check_email_address function
// Check specified email address syntax validity
// Originally from : http://www.ilovejackdaniels.com/php/email-address-validation/
// Updated by S. BLAISOT on Feb 02 2006 to check DNS MX of the domain
// Newer version implemented as a class can be found here : http://code.google.com/p/php-email-address-validation/
function
check_email_address(
$email
) {
// First, we check that there's one @ symbol, and that the lengths are right
if
(!
ereg
(
"^[^@]{1,64}@[^@]{1,255}$"
,
$email
)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return
false;
}
// Split it into sections to make life easier
$email_array
=
explode
(
"@"
,
$email
);
$local_array
=
explode
(
"."
,
$email_array
[0]);
for
(
$i
= 0;
$i
< sizeof(
$local_array
);
$i
++) {
if
(!
ereg
(
"^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$"
,
$local_array
[
$i
])) {
return
false;
}
}
if
(!
ereg
(
"^\[?[0-9\.]+\]?$"
,
$email_array
[1])) {
// Check if domain is IP. If not, it should be valid domain name
$domain_array
=
explode
(
"."
,
$email_array
[1]);
if
(sizeof(
$domain_array
) < 2) {
return
false;
// Not enough parts to domain
}
for
(
$i
= 0;
$i
< sizeof(
$domain_array
);
$i
++) {
if
(!
ereg
(
"^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$"
,
$domain_array
[
$i
])) {
return
false;
}
}
}
// DNS check of MX of the specified domainname
if
( !
checkdnsrr
(
$email_array
[1],
"MX"
) ) {
if
( !
checkdnsrr
(
$email_array
[1],
"A"
)) {
return
false;
}
}
return
true;
}
?>
usage :
//[...]
// Validate mail address
if
(!check_email_address(
$From
)) {
echo
"Adresse Invalide !\n"
;
}
else
{
echo
"Adresse mail valide\n"
;
}
-- Sébastien BLAISOT
Le 2012-08-23 08:06, A.L.E.C a écrit :
On 08/21/2012 06:34 PM, Benny Pedersen wrote:abuse@[127.0.0.1] is a valid email address, but roundcube says please provide atleast one email addressDoesn't work with current version too. It looks like javascript method for address validation doesn't handle this case. Please, open a ticket in bugtracker, so we could fix this issue in next version.