Mock mail on xampp development box

隐身守侯 提交于 2019-12-11 07:44:50

问题


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.


回答1:


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/

EDIT

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

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"

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

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/




回答2:


Is it connected to the internet? If you have access to other mail servers (Gmail, Host Provider Email) you can reroute your email using their settings.



来源:https://stackoverflow.com/questions/6190622/mock-mail-on-xampp-development-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!