阻止发送非来自特定域的电子邮件
我想过滤发送的电子邮件。电子邮件通过 PHP mail() 函数发送。我希望,如果可能的话,不修改任何 PHP 文件,只让电子邮件发送到特定域的电子邮件,而不发送其他域的电子邮件。我无权访问 SMTP 服务器。
I would like to filter emails sent. Emails are sent with the PHP mail() function. I would like, without modifying any PHP file if possible, to let emails out only emails that are to a specific domain, and not others. I don't have access to the SMTP server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以防万一这对某人有帮助......如果在提交表单(或类似操作)后发送电子邮件,您可以更改表单 html 元素的操作属性以指向充当过滤器的新 php 文件。一旦通过(如果是这样),您将重定向到“正确的”目的地来发送电子邮件。过滤可能很简单:
Just in case this helps someone ... If the emails are sent after a form is submitted (or similar action), you could change the action attribute of the form html element to point to a new php file that acts as a filter. Once passed (if so) you redirect to the "proper" destination to send the emails. The filtering could be something as easy as:
您应该能够查看“to”字段的关联数组,并使用 php 正则表达式类来匹配您列入黑名单的域。
You should be able to look at the associative array for the "to" field and use the php regex class to match domains that you blacklist.