本文章是利用phpmailer来实现在线发送邮件功能的源码代码.
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>--邀请好友参加</title> <style type="text/css"> <!-- body { margin: 0px; padding: 0px; font-size: 12px; background-color: #CFCFCF; } input { line-height: 18px; height: 18px; border: 1px solid #CCCCCC; } img { border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; } * { margin: 0px; padding: 0px; list-style-image: none; list-style-type: none; background-repeat: no-repeat; } td { line-height: 22px; font-size: 14px; font-weight: 700; color: #276662; } --> </style> </head> <body> <form action="#" method="post" name="form"> <table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="572" height="227" valign="top" background=http://pic2.phprm.com/2014/01/21/mailfooterimg.jpg <tr> <td height="70"> </td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><input type="text" value="http://111cn.net/" size="60" /></td> <td height="40"><a href="#"><img src="/static/imghwm/default1.png" data-src="img/copy.gif" class="lazy" style="max-width:90%" style="max-width:90%" / alt="php 发送邮件代码" ></a></td> </tr> </table></td> </tr> <tr> <td height="28">好友姓名: <input type="text" size="22" /> 邮箱地址: <input type="text" size="22" /> </td> </tr> <tr> <td height="28">好友姓名: <input type="text" size="22" /> 邮箱地址: <input type="text" size="22" /> </td> </tr> <tr> <td height="28">好友姓名: <input type="text" size="22" /> 邮箱地址: <input type="text" size="22" /> </td> </tr> <tr> <td height="28" align="right"><a href="#"><img src="/static/imghwm/default1.png" data-src="img/sendbtn.gif" class="lazy" style="max-width:90%" style="max-width:90%" / alt="php 发送邮件代码" ></a></td> </tr> </table></td> </tr> </table> </form> </body> </html>
发送邮件处理功能页面mail.php
<?php require (dirname(__FILE__) . "/mail/class.phpmailer.php"); //调用 phpmailer类型,如果没有phpmailer请点击这里下载phpmailer for php5/6 下载 $array = array_unique(Get_value('mail', 1)); //去除重复的邮箱地址 $mail = new PHPMailer(); $count = 0; $bad = 0; $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "smtp.163.com"; // smtp1.example.com;smtp2.example.comspecify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "mailangel123"; // SMTP username $mail->Password = "*******"; // SMTP password $mail->From = "mailangel123@163.com"; $mail->FromName = "你的好友来信"; $MailBody = '内容'$mail->AddReplyTo("mailangel123@163.com", "澳优"); $mail->AddAddress($tmpmail, '您好!'); $mail->WordWrap = 50; $mail->CharSet = "GB2312"; //$mail->AddAttachment("/var/tmp/file.tar.gz"); //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); $mail->IsHTML(true); $mail->Subject = "你的朋友邀请你一起合影!"; $mail->Body = $MailBody; if (!$mail->Send()) { $bad++; $mail->ClearAddresses(); $mail->ClearAttachments(); } ?>
OK就完成了哦。
教程链接:
随意转载~但请保留教程地址★
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章
R.E.P.O.能量晶体解释及其做什么(黄色晶体)
3 周前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
3 周前By尊渡假赌尊渡假赌尊渡假赌
刺客信条阴影:贝壳谜语解决方案
2 周前ByDDD
R.E.P.O.如果您听不到任何人,如何修复音频
3 周前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解锁Myrise中的所有内容
4 周前By尊渡假赌尊渡假赌尊渡假赌

热工具

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

禅工作室 13.0.1
功能强大的PHP集成开发环境