We are doing exactly this on our forms. The Marketo help article
Adding custom validation to a Marketo form before submitting it describes how to do this.
Below is the code that we use that checks for over 80 popular public email domains (some for creating temporary email addresses). Just add it into an HTML object below the form in the Landing Page Designer.
<!-- Validate the email address field in forms for a non-public domain -->
<script type="text/javascript" src="/js/public/jquery-latest.min.js"
language="JavaScript"></script>
<script type="text/javascript">
// set no conflict mode for jquery
var $jQ = jQuery.noConflict();
//edit this list with the domains you want to block
var invalidDomains = ["@123mail.org","@aol.com","@att.net","@bellsouth.net","@charter.net","@comcast.net","@cox.net","@earthlink.net","@gmail.com","@gmx.com","@gmx.de","@googlemail.com","@hotmail.","@juno.com","@live.","@mac.com","@mail.com","@me.com","@mindspring.com","@msn.com","@optonline.net","@pacbell.net","@rediffmail.com","@rocketmail.com","@rogers.com",".rr.com.","@sbcglobal.net","@sympatico.ca","@telus.net","@verizon.net","@yahoo.","@ymail.com","@zigmail.com","@bigstring.com","@bumpymail.com","@centermail.com","@centermail.net","@discardmail.com","@dodgeit.com","@e4ward.com","@emailias.com","@fakeinformation.com","@front14.org","@getairmail.com","@ghosttexter.de","@jetable.net","@kasmail.com","@link2mail.net","@mailexpire.com","@mailinator.com","@mailmetrash.com","@mailmoat.com","@messagebeamer.de","@mytrashmail.com","@nepwk.com","@nervmich.net","@netmails.net","@netzidiot.de","@nurfuerspam.de","@oneoffemail.com","@pookmail.com","@privacy.net","@punkass.com","@rmqkr.net","@sharklasers.com","@sneakemail.com","@sofort-mail.de","@sogetthis.com","@spam.la","@spambob.com","@spambob.net","@spambob.org","@spambog.com","@spamex.com","@spamgourmet.com","@spamhole.com","@spaminator.de","@spammotel.com","@spamtrail.com","@trash-mail.de","@trashymail.com","@trashmail.net","@yopmail.com","@wuzup.net"];
function formSubmit(elt) {
// run the custom validation. If it succeeds, run the Marketo validation
if (!isEmailGood()) {
Mkto.setError($jQ("#Email ~ span").prev()[0],"Please enter a business address, not one from a public service");
return false;
} else {
Mkto.clearError($jQ("#Email ~ span").prev()[0]);
}
return Mkto.formSubmit(elt);
}
function isEmailGood() {
for(i=0; i < invalidDomains.length; i++) {
if ( $jQ("#Email[value*=" + invalidDomains[i] + "]").length > 0) {
return false;
}
}
return true;
}
</script>