通过电子邮件和电子邮件进行电子邮件验证PHP?

发布于 2024-09-11 13:21:16 字数 284 浏览 5 评论 0原文

我在某些网站上看到,用户可以简单地将空白电子邮件发送到类似 [ email protected] 如果他们在获取验证电子邮件时遇到问题,请验证他们的电子邮件。我有一个使用 PHP/MySQL 的网站,我想实现同样的功能,但除了发送电子邮件之外,我没有对电子邮件做太多事情,所以我什至不知道从哪里开始设置这样的东西。

I have seen on some sites where the user can simply send a blank e-mail to something like [email protected] to have their e-mail verified if they are having trouble getting the verification e-mail. I have a website with PHP/MySQL that I'd like to implement this same functionality, but I haven't done much with e-mail besides sending it so I don't even know where to start to set something like this up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甩你一脸翔 2024-09-18 13:21:16

基本上,如果您的邮箱是 IMAP,您可以通过 PHP http:// www.php.net/manual/en/ref.imap.php(如果启用,请检查您的 phpinfo())并阅读该特定邮箱 (http://www.php.net/manual/en/function.imap-open.php)。
也许每 10 分钟运行一次 cronjob(我说 10 分钟,因为我没有看到很多人这样做),循环遍历所有电子邮件(如果有的话),运行您的逻辑来验证该电子邮件帐户,向他们发送一封电子邮件以表明其已验证,然后从您的帐户中删除该电子邮件项目,这样您就不会造成大量积压的电子邮件。

希望有人验证的方式很冒险,但这可能是这样做的一种方法。

Basically if your mailbox is an IMAP you could reference these functions via PHP http://www.php.net/manual/en/ref.imap.php (if enabled, check your phpinfo()) and read that specific mailbox (http://www.php.net/manual/en/function.imap-open.php).
Run a cronjob every 10 minutes maybe (I say 10minutes as I dont see many people doing this), loop thru all the emails (if any), run your logic to verify that email account, send them an email to say its been verified, then delete that email item from your account so you are not creating a massive backlog of emails.

Its risky way of wanting someone to verify but this is probably one way of doing it.

洛阳烟雨空心柳 2024-09-18 13:21:16

如果您的主机允许,您可以将收到的电子邮件传送到程序< /a> (在您的例子中,是一个 PHP 脚本),然后它可以解析消息并决定要做什么。

但是,我同意这不是很安全。除非您实施 DomainKey 检查或 DNS 查找,否则很容易欺骗发件人。

If your host allows you to, you can pipe received email to a program (in your case, a PHP script), which could then parse the message and decide what to do.

However, I agree that this isn't very secure. It would be very easy to spoof the sender, unless you implement DomainKey checking or DNS lookups.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文