·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> php网站开发 >> PHP发送邮件

PHP发送邮件

作者:佚名      php网站开发编辑:admin      更新时间:2022-07-23
php发送邮件 Posted on 2015-07-29 12:04 杨波PHP 阅读(...) 评论(...) 编辑 收藏

PHP发送邮件代码

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><?php//使用网吧数据接口,发送邮件php demo//本程序,你只需要改配置值,然后直接运行即可//=======//配置程序//=======#网吧数据KEY$key    =    '14297580222735684725947490211595';# smtp服务器地址, 如smtp.QQ.com$host = 'smtp.qq.com';# 发件人名称$fromname = '昵称随便定义';# 发件人邮箱账号$username = 'QQ邮箱账号';# 发件人邮箱密码$passwd = 'QQ邮箱密码';# 收件人邮箱账号$to = '[email protected]';# 邮件标题$subject = '标题,您好!';# 邮件内容,可以写HTML,等$email = '内容,您好,这是我们为您准备的内容。';//=======//逻辑处理程序//=======$subject    =    urlencode($subject);$email    =    urlencode($email);$handle = fopen ("http://www.zgw8.com/api.php/SendMail/Index/key/".$key."/language/xml/smtp/".$host."/fajianrenmingcheng/".$fromname."/fajianrenyouxiang/".$username."/fajianrenyouxiangmima/".$passwd."/shoujianrenyouxiang/".$to."/youjianbiaoti/".$subject."/youjianneirong/".$email, "rb");$contents = "";while (!feof($handle)) {    $contents .= fread($handle, 8192);}fclose($handle);function simplest_xml_to_array($xmlstring) {    return json_decode(json_encode((array) simplexml_load_string($xmlstring)), true);}//=======//获取到结果的程序//=======//返回值数组$arr    =    simplest_xml_to_array($contents);//打印数组PRint_r($arr);?>