la funzione di andr3a è attendibile, ovviamente per il solo formato, non potrai mai sapere se una mail è vera, ma solo se il formato è reale
se vuoi provare anche questa:
Codice PHP:
function checkMail (s:String):Boolean {
var temp = s.split(" ").join("");
if (temp.length > 0) {
if (temp.lastIndexOf("@") >- 1) {
var temp2 = temp.split("@");
if (temp2[1].length > 5) {
var temp3 = temp2[1].split(".");
if (temp3[0].length > 2 && temp3[1].length > 1) {
return true;
}
return false;
}
return false;
}
return false;
}
return false;
}
la usi così:
codice:
if (checkMail(testomail)) {
trace("indirizzo mail valido");
}