请问如何用php实现表单提交后以邮件的形式把表单内容发到邮箱中 如果没有自己的邮件服务器 用phpmailer可以发送邮件 http://baike.baidu.com/view/2341560.htm?fr=ala0_1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 给你部分代码?看看: $email = trim($_POST['email']); $hometel = htmlspecialchars($_POST['comment']); $validt = trim($_POST['validt']); if($_SESSION[checkkey] <> $validt && $validt) { echo '<script>alert("验证码输入不正确!");</script>'; }else{//判断各自段是否为空!!if($username != "" && $email != "" && $pwd != "" && $name!="" && $sex!="" && $date!="" && $dates!="" && $sf!="" && $tp!="" && $address!="" && $hometel!="" && $validt!=""){ $template = file_get_contents('template.html'); $template = str_replace('{username}',$username,$template); $template = str_replace('{userpwd}',$pwd,$template); $template = str_replace('{textname}',$name,$template); $template = str_replace('{gender}',$sex,$template); $template = str_replace('{year}',$date,$template); $template = str_replace('{month}',$dates,$template); $template = str_replace('{day}',$datese,$template); $template = str_replace('{sf}',$sf,$template); $template = str_replace('{contact_num0}',$tp,$template); $template = str_replace('{city}',$address,$template); $template = str_replace('{email}',$email,$template); $template = str_replace('{comment}',$hometel,$template); $content = $template; // *********************************** echo "$content"; require_once ('sendmail.php');//发送邮件类 ####################--发邮件--#################### $smtpserver = "smtp.126.com";//SMTP服务器 $smtpserverport = 25;//SMTP服务器端口 $smtpusermail = "";//SMTP服务器的用户邮箱 $smtpuser = "axiebin";//SMTP服务器的用户帐号 $smtppass = "";//SMTP服务器的用户密码 $smtpemailto = $email;//发送给谁 $mailsubject = "会员密码回函";//邮件主题 $mailtime = date("Y-m-d H:i:s"); $mailbody = $content; //邮件内容 $mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件 使用POST 文本框接过值,然后照着我写的代码套着用就可以了,我那些发法完整,需要你到网上找,自己研究研究吧 PHP编写网站程序的十个经验技巧 求知识,想仿制一个网站。。不是广告 thinkphp中怎么处理上传文件 100分请教: 图片加载--用户体验 zend 开发工具怎么没有即时提示啊 PHP或者JS实现选择图片后就能预览(无需上传) joomla相关 searchreplace,谁帮忙解释一下 php curl post 获取接口token,在本地速度很快,为什么放到线上就非常慢,将近10 秒才返回数据。 为何找不到PHP国密sm3 sm4的使用demo? 【开源】PHP 文件代码着色器 初来咋到,只为发帖
$email = trim($_POST['email']);
$hometel = htmlspecialchars($_POST['comment']);
$validt = trim($_POST['validt']);
if($_SESSION[checkkey] <> $validt && $validt)
{
echo '<script>alert("验证码输入不正确!");</script>';
}else{
//判断各自段是否为空!!
if($username != "" && $email != "" && $pwd != "" && $name!="" && $sex!="" && $date!="" && $dates!="" && $sf!="" && $tp!="" && $address!="" && $hometel!="" && $validt!=""){
$template = file_get_contents('template.html');
$template = str_replace('{username}',$username,$template);
$template = str_replace('{userpwd}',$pwd,$template);
$template = str_replace('{textname}',$name,$template);
$template = str_replace('{gender}',$sex,$template);
$template = str_replace('{year}',$date,$template);
$template = str_replace('{month}',$dates,$template);
$template = str_replace('{day}',$datese,$template);
$template = str_replace('{sf}',$sf,$template);
$template = str_replace('{contact_num0}',$tp,$template);
$template = str_replace('{city}',$address,$template);
$template = str_replace('{email}',$email,$template);
$template = str_replace('{comment}',$hometel,$template);
$content = $template; // *********************************** echo "$content";
require_once ('sendmail.php');//发送邮件类
####################--发邮件--####################
$smtpserver = "smtp.126.com";//SMTP服务器
$smtpserverport = 25;//SMTP服务器端口
$smtpusermail = "";//SMTP服务器的用户邮箱
$smtpuser = "axiebin";//SMTP服务器的用户帐号
$smtppass = "";//SMTP服务器的用户密码 $smtpemailto = $email;//发送给谁
$mailsubject = "会员密码回函";//邮件主题
$mailtime = date("Y-m-d H:i:s");
$mailbody = $content; //邮件内容 $mailtype = "HTML";//邮件格式(HTML/TXT),TXT为文本邮件