Before the message is sent, the user's basic information already exists in the database, if it is a bad mailbox or malicious multiple registration account that need to filter, the following for you to introduce the implementation of PHP common mailbox in the judgment
More and more Web sites want users to register with the mailbox, or to bind the mailbox, this time to confirm the correctness of the mailbox, some people use to send mail to activate the way to judge, thus activating an account, but there is a problem is, in the mail before sending out, The user's basic information already exists in the database. If it is a bad mailbox or malicious multiple registration account, it will cause the inactive account too much, occupy the database storage space, this side needs to do before the filtering of these mailboxes, so the author wrote down a method to filter the mailbox. Code as follows:/** * @todo user input Security detection * @param $inputString user input information * @return true/false * @final can be based on Its own requirements for filtering the content of the transformation */ public Function checkuserinput ($inputString) { if (strpos (' script ', $inputString)! =false) {//Detect if Script scripts return false; }else if (Strpos (' iframe ', $inputString)!=false) {//detect if an IFRAME frame is included return false; }else { return true; } } /** * @todo checkeemail * Param emailstring * @return false/true */ public Function Checkemail ($emailString) { if ($this-&G T Checkuserinput ($emailString) = = TRUE) {//Detect if sensitive words if (Strpos (' @ ', $emailString)!= FALSE) {//Detect presence @ Character $ Emailarr = explode (' @ ', $emailString); if (count ($EMAILARR) > 2) {//Detect presence of multiple@ character return false; }else{ if (In_array (' @ '. $EMAILARR [1], Yii::app ()-> params[' Mail_suffix '])) {// Detect if suffixes meet daily common mailbox suffixes return true; }else{ return false; } } }else{ return false;& nbsp } }else{ return false; } } in which I defined an array of commonly used mailbox suffixes, as follows: //Common mailbox suffix, According to the specific requirements can be added code as follows: ' Mail_suffix ' =>array (' @hotmail. com ', ' @msn. com ', ' @yahoo. com ', ' @ gmail.com ', ' @aim. com ', ' @aol. com ', ' @mail. com ', ' @walla. com ', ' @inbox. com ', ' @ 126.com ', ' @163.com ', ' @sina. com ', ' @21cn.com ', ' @sohu. com ', ' @yahoo. com.cn ', ' @ Tom.com ', ', @qq. com ', ' @etang. com ', ' @eyou. com ', ' @56.com ', ' the @x.cn ', ' Chinaren.com ', ' @sogou. com ', ' @citiz. com ', ', to this mailbox filtering method is completed, we can further improve on this basis!