Use chancejs github
email
chance.email()
chance.email({domain: "example.com"})
Return a random email with a random domain.
chance.email()
=> 'kawip@piklojzob.gov'
Optionally specify a domain and the email will be random but the domain will not.
chance.email({domain: 'example.com')
=> 'giigjom@example.com'
Or pure JavaScript
fiddle DEMO
function makeEmail() {
var strValues = "abcdefg12345";
var strEmail = "";
var strTmp;
for (var i = 0; i < 10; i++) {
strTmp = strValues.charAt(Math.round(strValues.length * Math.random()));
strEmail = strEmail + strTmp;
}
strTmp = "";
strEmail = strEmail + "@";
for (var j = 0; j < 8; j++) {
strTmp = strValues.charAt(Math.round(strValues.length * Math.random()));
strEmail = strEmail + strTmp;
}
strEmail = strEmail + ".com"
return strEmail;
}
console.log(makeEmail());