Home > Article > Backend Development > Solution to php email sending problem_PHP tutorial
When PHP sends an email, 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 the email.
In order to implement this function, I used the knowledge of how to send emails to the mailbox and obtain the login IP.
During this period, we have modified the login function of our system. For greater security, 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. 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. // www.jbxue.com
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 you can check it out later.
Send email:
First, you need to download the compressed package of phpmail, then unzip it, and copy the unzipped file to the project.
Introduce files into the project.