2013-03-23 107 views
0

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

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

+1

@DarkCthulhu还有什么我需要除了从'xampp'控制面板 – saplingPro 2013-03-23 07:26:06

+0

开始'mercury'您应该使用专用的做邮件库[ 1] [2]而不是php的邮件功能发送邮件。另外,您应该使用经过验证的帐户(例如gmail SMTP),否则您的电子邮件可能会被标记为垃圾邮件。 [1] http://swiftmailer.org/ [2] http://phpmailer.worxware.com/ – shachibista 2013-03-23 07:53:29

回答

0

我认为这将有助于:

编辑php.ini(XAMPP \ PHP \ php.ini中)。搜索[邮件功能]并相应地更改这些参数。

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 [email protected] 
#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上 tls_certcheck关闭 主机smtp.gmail.com 从[your_gmail_username] @ gmail.com AUTH上 用户[your_gmail_username] @ gmail.com 密码[your_gmail_password]

    端口如下所示587

  2. 设置默认帐户到Gmail:

    帐户默认:Gmail的

代码here