All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
用PHP写mail时的注意事项_[PHP教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/2/10 6:54:33 Browse times: 422 Comment times: 0

用PHP写mail时的注意事项_[PHP教程]


Head photo

Go homepage
Upload pictures
Write articles

用PHP写mail时的注意事项_[PHP教程]

今天看书,看到mail函数,就自己练着写了个简单的程序。

tomail='boy805@tom.com';
name='liuyu';
text='you win!!';

if(mail(tomail,name,text)) //函数有5个参数前3个是必填参数。第一个参数表示目的地址,第二个 参数表示为主题,第三个参数表示内容。
{
echo 'ok';
}
else
{
echo 'no';
}

?>
要注意的一点是,mail函数的使用,需要在php.ini里边配置。
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

配置后
[mail function]
; For Win32 only.
SMTP = smtp.tom.com //指定你的邮箱smtp
smtp_port = 25

; For Win32 only.
sendmail_from = boy805@tom.com //你所使用的邮箱

配置好后要记得重启apache啊!

不过真是怪了,在单位写的就发送成功了,在家写一样一样的就没成功,大家来看看~~

来源:phpchina





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.