Maison > développement back-end > tutoriel php > PHP发送邮件,php发送邮件代码_PHP教程

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

WBOY
Libérer: 2016-07-13 09:45:34
original
925 Les gens l'ont consulté

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>?>
Copier après la connexion

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1040162.htmlTechArticlePHP发送邮件,php发送邮件代码 PHP发送邮件代码 meta http-equiv="Content-Type" content="text/html; charset=utf-8" /? php // 使用网吧数据接口,发送邮件php...
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal