Xampp开发箱上的模拟邮件 [英] Mock mail on xampp development box

查看:92
本文介绍了Xampp开发箱上的模拟邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个本地开发箱,可以在将程序传输到测试服务器之前对其进行编码.这是基本的xampp设置.但是,当我必须在程序中发送邮件时,这限制了我在本地邮箱上进行测试的能力.有没有办法模拟这个?我不需要在本地计算机上设置邮件服务器.关于此主题的大多数问题都与设置邮件服务器有关.这就是为什么我要问这个特定问题.

I have a local development box that I code on before I transfer my programs to a test server. It's a basic xampp set up. However, this limits my ability to test on the local box when I have to send mail in my program. Is there a way to mock this? I don't have any desire to set up a mail server on my local machine. Most questions on this subject on stack deal with setting up a mail server. That's why I'm asking this particular question.

一如既往,感谢您的帮助和建议.

As always, Thank you for your help and advice.

推荐答案

我倾向于只通过SMTP使用GMAIL(很容易设置免费的测试GMAIL帐户). ProjectPier上有一个教程,只需在两行之间阅读并根据您的需要进行设置: http://www .projectpier.org/node/817

I tend to just use GMAIL via SMTP (easy enough to setup a free test GMAIL account). ProjectPier has a tutorial on it, just read between the lines and set it up for your needs: http://www.projectpier.org/node/817

还有一个通用的教程,我希望在这里使用:

There is also a generic tutorial, which I would prefer to use, here: http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/

编辑

要旨,只是因为您不能相信外部资源在这里生存下来,所以是在重写他们所谈论的内容:

The gist, just because you cannot trust external sources to stay alive here is re-write of what they talk about:

首先,您需要编辑php.ini(c:\ xampp \ php \ php.ini).找到[邮件功能]并更改以下设置:

First up you will need to edit the php.ini (c:\xampp\php\php.ini). locate the [mail function] and change the following settings:

SMTP = smtp.gmail.com
smtp_port = 465
sendmail_from = gmailusername@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

确保输入正确的xampp安装路径和驱动器号.接下来,我们需要编辑sendmail.ini,c:\xampp\sendmail\sendmail.ini添加以下内容(注意,您可能必须注释掉水银部分):

Make sure that you put in your proper xampp install path and drive letter. Next we need to edit the sendmail.ini, c:\xampp\sendmail\sendmail.ini add the following, (note you may have to comment out the mercury section):

account GmailTest
tls on
tls_certcheck off
host smtp.gmail.com
from gmailusername@gmail.com
auth on
user gmailusername@gmail.com
password gmailpassword
port 465

最后修改帐户默认值并将其设置为GmailTest,您应该会很好.对于上述内容,请转到 http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/

And finally modify the account default and set it to GmailTest and you should be good to go. Credits for the above goto http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/

这篇关于Xampp开发箱上的模拟邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆