phpcode Posted August 16, 2007 Share Posted August 16, 2007 I have an email form on my site that allows people to enter a from and to email address, I want to know if it is it possible to stop people from sending an email if the from address ends in something like @paypal.com? And give them an error. Quote Link to comment https://forums.phpfreaks.com/topic/65278-solved-stopping-people-sending-an-email/ Share on other sites More sharing options...
dbo Posted August 16, 2007 Share Posted August 16, 2007 Yup, before using the mail function look at the input, split it at the @ sign and see if it matches a list of allowed (or not allowed) domains, then act accordingly. Quote Link to comment https://forums.phpfreaks.com/topic/65278-solved-stopping-people-sending-an-email/#findComment-325978 Share on other sites More sharing options...
lemmin Posted August 16, 2007 Share Posted August 16, 2007 Or you can use substr_count to check if it exists. if (substr_count($_GET['to'], "@paypal.com") > 0) //error that they have a bad email "to" is the name of your input field that has the email you are checking. Quote Link to comment https://forums.phpfreaks.com/topic/65278-solved-stopping-people-sending-an-email/#findComment-325980 Share on other sites More sharing options...
phpcode Posted August 16, 2007 Author Share Posted August 16, 2007 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/65278-solved-stopping-people-sending-an-email/#findComment-326067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.