如何让 XAMPP 在本地使用 php 的 mail() 函数,以便我可以在本地测试我的 mail() 脚本而不必上传到我的服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4486155/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I enable XAMPP to locally use the php's mail() function so I can test my mail() scripts locally without having to upload to my server?
提问by Simon Suh
I am currently using XAMPP and Thunderbird 3 and wish to set up my local server to send mail to e-mails like gmail/hotmail/(anymail) so I can test out my php scripts that are using the mail() function. It would save some time as it would bypass the step of tediously saving and uploading the php file every time a minor change is made.
我目前正在使用 XAMPP 和 Thunderbird 3,并希望设置我的本地服务器以将邮件发送到诸如 gmail/hotmail/(anymail) 之类的电子邮件,以便我可以测试使用 mail() 函数的 php 脚本。它会节省一些时间,因为它会绕过每次进行微小更改时繁琐的保存和上传 php 文件的步骤。
Things I have done but have not worked: (through various existing tutorials online)
我做过但没有奏效的事情:(通过各种现有的在线教程)
- Installed XAMPP (successfully installed as I already use this for my other work)
- Installed Mercury for XAMPP
- In Mercury
- 已安装 XAMPP(已成功安装,因为我已将其用于其他工作)
- 为 XAMPP 安装 Mercury
- 在水星
a. click on Configuration -> Manage Local Users
b. Create New User
Username: **root**
Password: **root**
c. click on Configuration -> Mercury SMTP
d. make the following changes
IP Interface to use: **127.0.0.1**
Listen to TCP/IP port: **25**
Announce Myself as: **127.0.0.1**
e. click on Configuration -> Mercury POP 3
f. make the following changes
Listen to TCP port: **110**
IP Interface to use: **127.0.0.1**
g. click on Configuration -> MercuryE SMTP client Configuration
h. make the following changes
Identify Myself as: **127.0.0.1**
Name server: **127.0.0.1**
i. click on Configuration -> Mercury D pop3 client
j. make the following changes
POP3 Host: **127.0.0.1**
Username: **root**
Password: **root**
4. Installed Thunderbird 3 5. In Thunderbird
4. 安装 Thunderbird 3 5. 在 Thunderbird
a. click on Tools -> Account Settings
b. In Account Settings
i. click on Account Actions -> Add Mail Account
ii. In Add Mail Account
Your name: **root**
Email address: **[email protected]**
Password: **root**
iii. click next
vi. under Editing Config set as following
Username: **root**
Incoming: 127.0.0.1 POP/IMAP
Outgoing: 127.0.0.1 SMTP
v. click Create Account
c. send test mail to myself (this part doesn't work for me, it says mail sent successfully but when I check inbox in Thunderbird, there is no mail.)
4. Test PHP mail() script (I haven't gotten to this step yet as I have not yet been able to successfully set up a local mail server.)
4. 测试PHP mail()脚本(我还没有到这一步,因为我还没有能够成功设置本地邮件服务器。)
采纳答案by Ashley Staggs
These helped me out when I was having trouble.
当我遇到麻烦时,这些帮助了我。
http://www.danieltmurphy.com/setting-up-mercury-smtp/
http://www.danieltmurphy.com/setting-up-mercury-smtp/
http://www.youtube.com/watch?v=VU4PT7xMSO0
http://www.youtube.com/watch?v=VU4PT7xMSO0
Mercury can be activated from the Xampp control panel.
可以从 Xampp 控制面板激活 Mercury。