我的诉求:SMTP在Windows上无法使用mail函数发邮件,请剔除这个模块 (Issue #25459)
谁有能力来重写一下PHP mail 模块吧!
devnexen left a comment (php/php-src#25459)
So I asked chatgpt to help on this :)
The issue template was left empty, so there is no reproducer or error message to look at.
On Windows, mail() uses a minimal built-in SMTP client: it does not support SMTP authentication or TLS (STARTTLS / SMTPS). Most mail providers require both, so mail() can only deliver through a relay that accepts unauthenticated connections (for example a local MTA on localhost:25). This is a known limitation rather than a bug.
For sending through a provider, please use a library such as PHPMailer or Symfony Mailer, which support authentication and encryption.
Removing mail() on Windows would be a backward compatibility break and would need to go through the RFC process (PHP: rfc:howto), so it can't be handled as a bug report. Closing for now. If you get a specific warning from mail() against a server that does not require authentication, feel free to reopen with the exact message and your SMTP/smtp_port/sendmail_from settings.
谢谢反馈。Windows 上的 mail() 使用内置的简易 SMTP 客户端,不支持 SMTP 认证和 TLS 加密,因此无法直接通过需要认证的邮件服务商发送邮件。这是已知限制,不是 bug。建议使用 PHPMailer 或 Symfony Mailer。移除该功能属于不兼容变更,需要走 RFC 流程。