是否可以在 php.ini 级别仅允许 PHP 邮件发送到某些电子邮件地址
每当我在向用户发送电子邮件的网站上进行开发时,我都必须记住注释掉 mail() 代码,这样我就不会在摆弄和调试时意外触发通知电子邮件,这是一种痛苦,有时我会忘记并在我无意的时候向人们发送电子邮件。
有没有办法在 php.ini 级别(或其他一些低级别)的电子邮件地址(也允许 mail() 发送)强制执行白名单?
其他人有聪明的方法来避免这个问题吗?
Whenever I'm doing development on a site which sends emails to users I have to remember to comment out the mail() code so that I don't accidentally trigger the notification email whilst fiddling around and debugging, it's a pain and occasionally I forget and send emails to people when I didn't mean to.
is there a way to enforce a whitelist at the php.ini level (or some other low level) of email addresses that mail() is allowed to send too?
Do other people have clever ways of avoiding this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会在 SMTP 级别执行此操作。在那里进行配置,让 PHP 使用仅用于开发的特定 SMTP 服务器。
I would do this at the SMTP level. Configure it there and have PHP use a specific SMTP server that is only for development.
为什么不为您的网站设置
维护模式
?Why not have a
maintenance mode
setting for your site?不在该级别,但有多种解决方法:
Not at that level, but there are various workarounds: