【问题标题】:sending email using xampp使用 xampp 发送电子邮件
【发布时间】:2013-03-13 03:18:25
【问题描述】:

我可以使用XAMPP 发送电子邮件吗?目前我在XAMPP 中运行Mercury 作为邮件服务器。

我想在我的笔记本电脑上测试一个需要在 2 小时后发送电子邮件的应用程序。我一直在尝试使用mail 函数发送电子邮件,但没有收到任何邮件。

【问题讨论】:

  • @DarkCthulhu 除了从xampp 控制面板启动mercury 之外,我还需要做什么
  • 您应该使用专用的邮件库 [1][2] 而不是 php 的邮件功能来发送电子邮件。此外,您应该使用经过验证的帐户(例如 gmail SMTP),否则您的电子邮件可能会被标记为垃圾邮件。 [1] swiftmailer.org [2] phpmailer.worxware.com

标签: php windows email xampp


【解决方案1】:

我认为这会有所帮助:

编辑您的 php.ini (xampp\php\php.ini)。搜索 [mail function] 并相应地更改这些参数。

SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = [your_gmail_username]@gmail.com
Note: this gmail account will be used to send the email
sendmail_path = “\”D:\xampp\sendmail\sendmail.exe\” -t”

注意:我确实安装了我的xampp at D:\xampp 编辑您的sendmail.ini (xampp\sendmail\sendmail.ini)“Mercury” and “A free mail service example”的内容注释如下:

# Mercury
#account Mercury
#host localhost
#from postmaster@localhost
#auth off

# A freemail service example
#account Hotmail
#tls on
#tls_certcheck off
#host smtp.live.com
#from [exampleuser]@hotmail.com
#auth on
#user [exampleuser]@hotmail.com
#password [examplepassword]
  1. 添加您要用来发送邮件的帐户。在我的示例中,我配置了 Gmail 帐户,如下所示:

    帐户 Gmail 开启 tls_certcheck off 主机 smtp.gmail.com 来自 [your_gmail_username]@gmail.com 授权开启 用户 [your_gmail_username]@gmail.com 密码 [your_gmail_password]

    端口 587

  2. 如下图设置默认帐号为Gmail:

    帐户默认值:Gmail

来自here的代码

【讨论】:

    猜你喜欢
    • 2012-05-07
    • 2021-09-12
    • 2013-03-30
    • 1970-01-01
    • 2016-07-29
    • 2018-03-08
    • 2015-06-01
    相关资源
    最近更新 更多