// Check to see if the emails provided are actually valid for this student - if they are, returns them in list, if not - logs and moves on to next
function checkValidEmails(emailList){
var emailArr=emailList.split(',');
var newEmailList='';
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
for (var e=0;e<emailArr.length;e++){
if(emailArr[e].match(mailformat)){
// Valid email address
if(newEmailList.length==0){
newEmailList=emailArr[e];
}else{
newEmailList+=','+emailArr[e];
}
}else{
//invalid email address
//log the error but continue on to send emails
}
}
return newEmailList;
}