Home > php教程 > php手册 > body text

php 邮件发送问题解决

WBOY
Release: 2016-06-06 20:23:45
Original
1117 people have browsed it

验证错误不能登陆,需重新输验证码,或在发送新的验证码到邮箱。为了实现此功能,我用到了如何向邮箱发送邮件,以及获取登陆ip的知识

这段时间修改了一下我们系统的登陆功能,为了更加安全,增加了发送邮件验证功能。当用户登陆的时候判断登陆ip是否是之前登陆过的,如果不是的话,需要向邮箱里发送验证码,然后把收到的验证码输入再登陆,如果验证码正确并且时间没有超过规定时间,可以登陆,并且记下此次登陆的ip和时间,以后再以此ip登的话,就不用验证了。如果时间超过了,,验证码失效,需重新发送。验证错误不能登陆,需重新输验证码,或在发送新的验证码到邮箱。为了实现此功能,我用到了如何向邮箱发送邮件,以及获取登陆ip的知识。下面整理一下,以便以后自己查看。

发送邮件:

首先需要下载phpmail的压缩包,然后解压,把解压后的文件复制到项目中。在项目中引入文件。

复制代码 代码如下:


require("phpmailer/class.phpmailer.php"); //文件的路径具体看自己的项目中的路径是怎么样的

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!