我在本地主机windows上使用XAMPP VISTA m/c.使用gmail作为smpt服务器
我试图用简单的PHP脚本发送电子邮件
下面是sendmail.ini的配置细节(我在该目录中有sendmail.exe和其他2个dll )。
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=465
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
default_domain=localhost
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=xxxxxxx
auth_password=xxxxxx
hostname=localhost
and I have changed the php.ini
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25
; For Win32 only.
;sendmail_from = xxxxx
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"一旦我调用脚本,它就会进入waiting...for本地主机.这是debug.log..。
09/05/02 17:34:41 ** -信息开始- 09/05/02 17:34:41 ** To: xxx@yahoo.com 09/05/02 17:34:41 **主题:表格提交结果09/05/02 17:34:41 **来自:我的网站09/05/02 17:34:41 *答复: xxx@gmail.com 09/05/02 17:34:41 * 09/05/0217:34:41 **名称: xxx 09/05/02 17:34:41 *电子邮件: xxx@yahoo.com 09/05/02 17:34:41 **消息:嘿测试讯息09/05/02 17:34* 09/05/02 17:34:41 * 09/05/02 17:34:41 ** 05/02 17:34:41 **结束- 09/05/02 17:34:41 **连接到smtp.gmail.com:465 09/05/02 17:34:41 **已连接。
我是PHP的新手,我想知道是否有更好的方式来处理邮件.我现在不喜欢带有附件的HTML/多部分邮件。而且,如果没有安装SMTP服务器,我应该能够在本地主机上进行测试。现在我想使用GMAIL进行测试。THnks
发布于 2009-05-02 23:37:16
我强烈建议你使用一个库,例如PHPMailer。这是他们的gmail示例。
另一个很好的库(我还没有使用)是SwiftMailer。这是他们的gmail示例。
发布于 2009-05-02 23:06:43
GMAIL需要SSL afaik。
免费的(而且可能是“好的”) php邮件库,我知道邮件和斯威夫特梅尔。
发布于 2009-05-02 23:24:34
你也应该向你的ISP查询。为了防止垃圾邮件,他们中的许多人封锁了端口25。
https://stackoverflow.com/questions/815843
复制相似问题