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

WBOY
發布: 2016-07-13 09:45:34
原創
903 人瀏覽過

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
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板