User Tools

Site Tools


web_development:bad_mail
Bad Mail

Services such as [http://www.mailinator.com/ Mailinator] can be very handy when you're forced to enter an email address at a potentially malicious site and want to protect your identity. But sometimes, it's just not appropriate to use them. Such as when ordering product, or registering for a legitimate service.

In an attempt to block users from entering these types of fake email addresses, here's a bit of code.

Source Code:

bad_mail.php
<?php
 
// assuming the email address is being received by $_POST[email].  Change if needed.
list($username,$domain)=split('@',$_POST[email]);
 
// of course, you can add any domain to the array you like.  CSV.
$badmail = array('meltmail.com', 'mailinator.com', 'mailinator2.com', 'sogetthis.com', 'mailin8r.com', 'mailinator.net', 'spamherelots.com', 'thisisnotmyrealemail.com', 'justonemail.net', 'letmymail.com', 'onemoremail.net', 'yopmail.com', 'yopmail.fr', 'yopmail.net', 'jetable.fr.nf', 'nospam.ze.tc', 'nomail.xl.cx', 'mega.zik.dj', 'speed.1s.fr', 'cool.fr.nf', 'courriel.fr.nf', 'moncourrier.fr.nf', 'monemail.fr.nf', 'monmail.fr.nf', 'bsnow.net', 'guerrillamailblock.com', 'jetable.com', 'filzmail.com', 'nowmymail.com', 'maileater.com', 'emailzorz.com', 'spam.la', 'mailcatch.com', 'spambox.us', 'tyldd.com');
 
if (!in_array(strtolower($domain), $badmail)) {
 // the domain is trusted, do something
 
 
}
else
{
 // the domain is bad
 echo $username . "@" . $domain . " is not an accepted email address.";
}
unset($username,$domain,$badmail);
 
?>
web_development/bad_mail.txt · Last modified: 2012/01/26 09:00 by import