Apex Trigger
trigger ContactTrigger on Contact (before insert) {
Set<String> oldEmails = new Set<String>();
for(Contact con : [SELECT id, Email FROM Contact]){
oldEmails.add(con.Email);
}
for(Contact con : Trigger.new){
if(oldEmails.contains(con.email)){
con.email.addError('An account with the same name is already exists.');
}
}
}