应用程序想要从本地主机发送电子邮件
我正在开发一个php应用程序,需要测试发送电子邮件的功能。问题是我正在使用开发环境(Windows 上的 wamp),所以我猜我无法访问 smtp 或邮件服务器。
看起来我可能需要安装一个单独的应用程序来充当我的邮件服务器。最简单的方法是什么(我在 Windows 上工作 wamp),是否有另一种替代方案,例如供开发人员用于测试的公共服务器(请免费,因为我可能只会使用它 10 次,直到电子邮件功能已调整)。那么我想我的开发环境本身需要更改一些设置?任何人都可以阐明这一点。
谢谢
I'm developing a php application and need to test the functionality of sending emails. Problem is I'm using a development environment (wamp on windows) so I'm guessing I don't have access to smtp or a mail server.
It looks like I may need to install a separate application that would act as my mail server. What's the easiest way to do this (I'm on windows working on wamp), and is there another alternative like a public server to be used for testing by developers (free please because I'll probably use it just 10 times until the email functionality is tweaked). Then I guess there are settings that I need to change to my development environment itself? Anyone can shed some light on this please.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
XAMPP 附带 Mercury 处理电子邮件。如有必要,它可以通过 SSL 与 SMTP 服务器通信,并且对我来说效果很好。
XAMPP comes with Mercury to handle E-Mails. It can talk to SMTP servers through SSL if necessary, and works well for me.
您需要一个 SMTP 服务器。我使用 PostCast Server,它是免费的并且可以满足需要。
You need an SMTP Server. I use PostCast Server, which is free and does the needful.
您是否尝试过创建虚假的 GMail 帐户,然后通过其 SMTP 服务器发送电子邮件?这是例子 - 对我来说效果很好。
http://phpmailer.worxware.com/index.php?pg=exampleagmail
Have you tried creating fake GMail account and then sending emails through its SMTP server? Here is the example - for me works fine.
http://phpmailer.worxware.com/index.php?pg=exampleagmail
您是否尝试过 PHP 函数
http://php.net/manual/en/function.mail .php
Have you tried PHP function
http://php.net/manual/en/function.mail.php
XAMPP 附带了一个“假”sendmail 程序。如果您使用 XAMPP,则可以按如下方式使用 sendmail:(忽略“仅适用于 Unix”警告;它在 Windows 上工作正常)
Sendmail 应该有一个
sendmail.ini
;应该这样配置:当然,将 ACCOUNTNAME_HERE 替换为任意帐户名称,将 EMAIL_HERE 替换为有效的电子邮件(例如 Gmail 或 Hotmail),并将 PASSWORD_HERE 替换为您的电子邮件的密码。现在,您应该能够发送邮件了。请记住重新启动 Apache(从控制面板或批处理文件)以使对 PHP 的更改生效。
XAMPP comes with a "fake" sendmail program. If you use XAMPP, you can use sendmail as so: (ignore the "For Unix only" warning; it works fine on Windows)
Sendmail should have a
sendmail.ini
with it; it should be configured as so:Of course, replace ACCOUNTNAME_HERE with an arbitrary account name, replace EMAIL_HERE with a valid email (such as a Gmail or Hotmail), and replace PASSWORD_HERE with the password to your email. Now, you should be able to send mail. Remember to restart Apache (from the control panel or the batch files) to allow the changes to PHP to work.