佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1234|回复: 4

PHP MAIL

[复制链接]
发表于 27-9-2008 09:34 AM | 显示全部楼层 |阅读模式
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\EasyPHP 2.0b1\www\eleave\leave_pending.php on line 62

当我要用php send mail的时候,出现上面的问题,要怎么改?

我是用这个code来send的
<?php
$to = "xxx@hotmail.com";
$from = "aaa@gmail.com";
$from_header = "From: $from";
$subject = "Test E-Mail (This is the subject of the E-Mail)";
$c;

if(mail($to, $subject, $contents, $from_header))
{
    echo "The email($subject) was successfully sent.";
}
else {
    echo "The email($subject) was NOT sent.";
}
?>


[ 本帖最后由 star4u 于 27-9-2008 09:55 AM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 27-9-2008 12:20 PM | 显示全部楼层
你的 localhost 米有 smtp
回复

使用道具 举报

发表于 27-9-2008 06:58 PM | 显示全部楼层
原帖由 star4u 于 27-9-2008 09:34 AM 发表
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\EasyPHP 2.0b1\www\el ...



到你的 php.ini 中找出你的 mail function, 然後把下方 SMTP 的 localhost 該成你 ISP 所提供的 SMTP 網址及 sendmail_from 改成你的 email 帳號
回复

使用道具 举报

 楼主| 发表于 28-9-2008 10:28 AM | 显示全部楼层
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465
; For Win32 only.
;sendmail_from = xxx@gmail.com

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\EasyPHP 2.0b1\www\eleave\leave_pending.php on line 60

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\EasyPHP 2.0b1\www\eleave\leave_pending.php on line 61

我放错了吗?

[ 本帖最后由 star4u 于 28-9-2008 10:39 AM 编辑 ]
回复

使用道具 举报

发表于 30-9-2008 10:29 AM | 显示全部楼层
gmail 用的是 ssl connection, 可能 php 的 default mail() 不适用

你可以试用 phpmailer()
我用 phpmailer 可以 connect 去谷歌

https://secure.web-hosting.net.m ... &kbarticleid=34
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-12-2025 11:25 PM , Processed in 0.144966 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表