有没有办法使用 php 检查电子邮件是否存在?

发布于 2024-07-20 10:53:36 字数 535 浏览 2 评论 0原文

最近我收到的垃圾邮件越来越多。 我已经使用正则表达式验证了我的电子邮件,所有电子邮件都必须是这样的: [email  protected]

但我现在遇到的问题是,有很多垃圾邮件发送者,输入 [电子邮件受保护][电子邮件受保护],这些电子邮件不存在,因为我试图向他们发送电子邮件。

如何避免这些电子邮件?

I am getting more and more spam emails recently. I already validate my email using regular expression, all the emails must be something like this: [email protected]

But the problem i have now is, there are alot spammers, type [email protected], [email protected], these emails are not existed, because i tried to send email to them.

How to avoid those email?

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

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

发布评论

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

评论(3

终遇你 2024-07-27 10:53:36

你找错了树。 阻止垃圾邮件的更好方法是通过其他方式从表单中过滤掉它们。 如果您不喜欢 reCAPTCHA 等验证码,您应该研究一下所谓的 "蜜罐"。 本质上,在您的表单中添加一个具有常用名称(例如“电子邮件”)的额外字段,并使用 CSS 隐藏它。 对于任何浏览禁用样式的人,将其标记为“留空”。 如果该字段有值,则很可能是机器人,因此请丢弃该提交。 瞧。 它们非常适合垃圾邮件发送者并不真正愿意专门攻击的普通中型网站。 查看此相关问题

综合考虑,我喜欢蜜罐,因为它通常足以阻止 99% 的垃圾邮件,同时又不会让普通用户必须做任何事情。 这个很重要。

快速回答您最初的问题:验证电子邮件有效的唯一方法是实际向该地址发送电子邮件并查看它是否被退回。 然而,这通常不值得这么麻烦。

You're barking up the wrong tree. The better way to stop spam is by filtering them out in other ways from the form. If you are not a fan of CAPTCHAs like reCAPTCHA, you should look into what is known as "Honeypots". Essentially, add an extra field to your form with a common name like "email" and hide it with CSS. Mark it as "leave blank" for anyone browsing with styles disabled. If the field has a value in it, it is most likely a bot, so throw the submission out. Voila. They work really well for your average mid-size website that spammers don't really care to specifically set out to beat. Check out this related question.

All things considered, I like the honeypots because it is usually enough to deter 99% of your spamming while not making your average user have to do anything. This is important.

To quickly answer your original question: the only way to verify the email is valid is to actually send out an email to that address and see if it bounces. It is generally not worth the hassle, however.

眼泪都笑了 2024-07-27 10:53:36

如果他们正在订阅时事通讯或您将多次向他们发送电子邮件的内容,我想向他们发送一封确认电子邮件,他们必须单击链接以验证它是否是真实的电子邮件。 如果几天后他们没有确认,那么您就可以删除它。 如果他们确实确认,那么您就知道这是一个真实的人。 当您第一次向他们发送电子邮件时,您仍然会收到退回邮件,但这将消除重复发生的退回邮件。

我也喜欢验证码,或者如果您想要更简单的东西,请他们输入您网站标题的第一个字母(或页面上始终保持不变的其他单词),它适用于中小型网站,但大多数情况下有效的。

If they are signing up for a newsletter or something that you will email them more than once I like to send a confirmation email to them which they must click a link to verify that it is a real email. If they dont confirm after a few days then you know you can delete it. If they do confirm then you know that it is a real person. You will still get bounce backs when you first email them but it will eliminate reoccurring bounce backs.

I also like CAPTCHAs or if you want something simpler ask them to enter the first letter of the title of your website (or some other word that will always remain the same on the page), it works for smaller to mid sized sites but is mostly effective.

烛影斜 2024-07-27 10:53:36

简短回答:

使用验证码。

长答案:

嗯,您可以进行 MX 查找,找到负责为其给定域传送电子邮件的服务器,然后查询邮件服务器以查看该地址是否有效。 在完美的世界中,这将是验证电子邮件地址的理想方式。

不幸的是,作为一种反垃圾邮件措施,现在大多数邮件服务器都会以全部肯定或全部否定的方式响应此类查询。

这让我们实际上只有一种实用的解决方案:验证码。

Short answer:

Use a CAPTCHA.

Long answer:

Well, you could do an MX lookup, where you find the server responsible for delivering email for their given domain, then query the mail-server to see if the address is valid. In a perfect world, this would be the ideal way to validate email addresses.

Unfortunately, as an anti-spam measure, most mail servers these days will respond to such a query with either all positives or all negatives.

This leaves us with really only one practical solution: CAPTCHAs.

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