XAMPP 邮件不适用于 PHP mail() 函数

2022-01-14 00:00:00 email xampp php

我刚刚安装了 XAMPP,Apache 正在运行,MySQL 和 Mercury 也在运行.

I just installed XAMPP, Apache is running, so is MySQL and Mercury.

在 Dreamweaver 中,我使用 mail($to,$subject,$msg,'From:'.$email); 函数创建了一个 php 文件,但是当我从 localhost 运行文件时显示错误.玩过xampp控制面板,打开和关闭水银后,它没有显示任何错误,也没有发送电子邮件......有什么想法吗?

In Dreamweaver I created a php file with a mail($to,$subject,$msg,'From:'.$email); function, but when I ran the file from localhost it showed an error. After playing around with xampp control panel, turning mercury on and off, it's not showing any errors, yet is not send the email either... any ideas?

cp 上的 'admin' 按钮对于水星没有任何作用.

the 'admin' button on the cp for mercury does nothing.

谢谢!回复

推荐答案

你必须 配置与 xampp 捆绑的水星服务器 以实际传递/中继邮件.

You would have to configure the mercury server bundled with xampp to actually deliver/relay the mails.

但我建议你使用 SwiftMailer 之类的东西,而不是 php 的 mail() 函数.

But I suggest you use something like SwiftMailer instead of php's mail() function.

还有第三个选项.php/win32 内置的 mini-smtp-client 不能做认证.因此你不能简单地把 SMTP=mail.gmail.com;smtp_port=25 在您的 php.ini 中.但是您可以设置 sendmail_path 并指向可以中继的应用程序向另一个 smtp 服务器发送消息(包括身份验证),例如假发送邮件.
(但我还是建议使用 swiftmailer)

edit: there is a third option. The mini-smtp-client built into php/win32 can't do authentication. Therefore you can't simply put SMTP=mail.gmail.com; smtp_port=25 in your php.ini. But you can set sendmail_path and point to an application that can relay the message to another smtp server (including authentication), e.g. fake sendmail.
(But I still suggest swiftmailer)

相关文章