Home >Backend Development >PHP Tutorial >PHP email sending problem solution_PHP tutorial

PHP email sending problem solution_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:35:161062browse

During this time, we have modified the login function of our system, and added a verification function for sending emails for greater security. When the user logs in, it is judged whether the login IP has been logged in before. If not, a verification code needs to be sent to the mailbox, and then the received verification code must be entered before logging in. If the verification code is correct and the time has not exceeded the specified time, you can Log in, and write down the IP and time of this login. If you log in with this IP in the future, you will not need to verify it. If the time exceeds, the verification code becomes invalid and needs to be sent again. If there is a verification error and you cannot log in, you need to re-enter the verification code or send a new verification code to your email. In order to implement this function, I used the knowledge of how to send emails to the mailbox and obtain the login IP. Let’s sort it out so that you can check it out later.

Send an email:

First you need to download the compressed package of phpmail, then decompress it, and copy the decompressed file to the project. Import files into the project.

Copy code The code is as follows:

require("phpmailer/class.phpmailer.php"); //File path Specifically, it depends on the path in your project

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/744709.htmlTechArticleDuring this period, we have modified the login function of our system. In order to be more secure, we have added a verification function for sending emails. When the user logs in, it is judged whether the login IP has been logged in before, such as...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn