首页 > 后端开发 > php教程 > PHP发送邮件,php发送邮件代码_PHP教程

PHP发送邮件,php发送邮件代码_PHP教程

WBOY
发布: 2016-07-13 09:45:34
原创
950 人浏览过

PHP发送邮件,php发送邮件代码

PHP发送邮件代码

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?<span>php
</span><span>//</span><span>使用网吧数据接口,发送邮件php demo
//本程序,你只需要改配置值,然后直接运行即可

//=======
//配置程序
//=======</span>

<span>#</span><span>网吧数据KEY</span>
<span>$key</span>    =    '14297580222735684725947490211595'<span>;
</span><span>#</span><span> smtp服务器地址, 如smtp.qq.com</span>
<span>$host</span> = 'smtp.qq.com'<span>;
</span><span>#</span><span> 发件人名称</span>
<span>$fromname</span> = '昵称随便定义'<span>;
</span><span>#</span><span> 发件人邮箱账号</span>
<span>$username</span> = 'QQ邮箱账号'<span>;
</span><span>#</span><span> 发件人邮箱密码</span>
<span>$passwd</span> = 'QQ邮箱密码'<span>;
</span><span>#</span><span> 收件人邮箱账号</span>
<span>$to</span> = '3039439790@qq.com'<span>;
</span><span>#</span><span> 邮件标题</span>
<span>$subject</span> = '标题,您好!'<span>;
</span><span>#</span><span> 邮件内容,可以写HTML,等</span>
<span>$email</span> = '内容,您好,这是我们为您准备的内容。'<span>;

</span><span>//</span><span>=======
//逻辑处理程序
//=======</span>

<span>$subject</span>    =    <span>urlencode</span>(<span>$subject</span><span>);
</span><span>$email</span>    =    <span>urlencode</span>(<span>$email</span><span>);
</span><span>$handle</span> = <span>fopen</span> ("http://www.zgw8.com/api.php/SendMail/Index/key/".<span>$key</span>."/language/xml/smtp/".<span>$host</span>."/fajianrenmingcheng/".<span>$fromname</span>."/fajianrenyouxiang/".<span>$username</span>."/fajianrenyouxiangmima/".<span>$passwd</span>."/shoujianrenyouxiang/".<span>$to</span>."/youjianbiaoti/".<span>$subject</span>."/youjianneirong/".<span>$email</span>, "rb"<span>);
</span><span>$contents</span> = ""<span>;
</span><span>while</span> (!<span>feof</span>(<span>$handle</span><span>)) {
    </span><span>$contents</span> .= <span>fread</span>(<span>$handle</span>, 8192<span>);
}
</span><span>fclose</span>(<span>$handle</span><span>);
</span><span>function</span> simplest_xml_to_array(<span>$xmlstring</span><span>) {
    </span><span>return</span> json_decode(json_encode((<span>array</span>) <span>simplexml_load_string</span>(<span>$xmlstring</span>)), <span>true</span><span>);
}




</span><span>//</span><span>=======
//获取到结果的程序
//=======

//返回值数组</span>
<span>$arr</span>    =    simplest_xml_to_array(<span>$contents</span><span>);
</span><span>//</span><span>打印数组</span>
<span>print_r</span>(<span>$arr</span><span>);

</span>?>
登录后复制

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1040162.htmlTechArticlePHP发送邮件,php发送邮件代码 PHP发送邮件代码 meta http-equiv="Content-Type" content="text/html; charset=utf-8" /? php // 使用网吧数据接口,发送邮件php...
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板