Io ho già un codice che valida una mail, ho tentato modificarlo in modo che validi prima l'user (validità e lunghezza), e poi il dominio, ma non so nemmeno se si può pare una cosa del genere.
Io questi codici:
	
	
	
		
				
			Io questi codici:
		PHP:
	
	/* Mail caratteri max inseribili */ 
function contaEmailScrivimi1() {
var val = document.forms.mioform1;
max=320
if (val.suoemail.value.length > max) {
val.suoemail.value = val.suoemail.value.substring(0,max);
val.suoemail.style.borderColor='black';
val.suoemail.style.backgroundColor='#d8ecff';
document.getElementById('emailx').innerHTML = "Mail: max 320 caratteri";
} 
else {
val.suoemail.style.borderColor='';
val.suoemail.style.backgroundColor='';
document.getElementById('emailx').innerHTML = "";
}
 }
...
function emailCampo1() {
var f = document.forms.mioform1;
if (f.suoemail.value.length != 0) { 
var reg = new RegExp("^((.*)[@](.*)[.][a-z]{2,6})$");                                  
if (!f.suoemail.value.match(reg)) { 
f.suoemail.style.borderColor='black'                                                                                                     
f.suoemail.style.backgroundColor='#d8ecff'
document.getElementById('emailx2').innerHTML = "Inserire una Mail valida";
f.suoemail.focus();
return false;
}
else{
document.getElementById('emailx2').innerHTML = "";
}  
 }  
else {
document.getElementById('emailx2').innerHTML = "";
}
return true;
}