Kovich Posted May 13, 2010 Share Posted May 13, 2010 Hello everyone. My name is Kovich and today I have a problem that I would like some assistance with. I am using PHP Auto Responder to collect subscriptions to my mailing list located on my blog. I'm getting a ton of great registrations - but mixed in with them are some spam domains - you know, things made with TrashMail, QuickMail, Spam.LA, etc. They're signing up just to get the free gift, and I'd like this to stop. Therefore, I am interested in banning some of these domain names from registering. The system already checks that the e-mail address is in valid format, and if it isn't, it tells the user that the e-mail address is invalid - I would simply like to display this error to anyone using any one of the domains on my list. Therefore, I would appreciate someone walking me through how to add a domain name exclusion to the software. I believe I located the part of the code in which this would need to be implemented. I'm not very good with PHP - I just started following an online tutorial recently, so let's hope for the best. Unfortunately, I'd like to have this problem fixed before I master enough knowledge of the language. =P function initialize($initialization_data = array()) { if (!empty($initialization_data)) { if (!empty($initialization_data['id'])) $this->id = intval($initialization_data['id']); if (!empty($initialization_data['name'])) $this->name = $initialization_data['name']; if (!empty($initialization_data['email']) && preg_match('@^[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&\'*+/0-9=?A-Z^_a-z{|}~])*\@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$@',$initialization_data['email'])) $this->email = $initialization_data['email']; if (!empty($initialization_data['join_date'])) $this->join_date = $initialization_data['join_date']; if (isset($initialization_data['subscribed'])) $this->subscribed = ($initialization_data['subscribed']?true:false); if (isset($initialization_data['verified'])) $this->verified = ($initialization_data['verified']?true:false); } } function isReadyForSave() { if (!empty($this->name) && !empty($this->email)) return true; return false; } } It seems logical to me that it goes somewhere in there. So can someone help show me how to block a domain name? For example: @spam.la Thanks a ton in advance! Link to comment https://forums.phpfreaks.com/topic/201688-preg_match-blocking-e-mail-domains/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.