当前位置:编程学习 > php >>

php 利用phpmailer 在线发送邮件

php教程 利用phpmailer 在线发送邮件

html代码

<form action="lead_mail_send.php" method="Post" enctype="multipart/form-data" name="myfm">
  <table width="80%" border="0" align="center" cellspacing="6">
    <tr>
      <td width="10%">邮箱:</td>
      <td width="90%"><label>
        <input name="mail" type="text" id="mail" size="18" />
      </label></td>
    </tr>
    <tr>
      <td>电话:</td>
      <td><input name="tel" type="text" id="tel" size="18" /></td>
    </tr>
    <tr>
      <td>内容:</td>
      <td><label>
        <textarea name="bodys" id="bodys" cols="45" rows="5"></textarea>
      </label></td>
    </tr>
    <tr>
      <td> </td>
      <td><label>
        <input name="button2" type="submit" class="but01" id="button2" value="发布提交" onclick="return check();" />
        <input name="button3" type="reset" class="but02" id="button3" value="清楚建议" />
      </label></td>
    </tr>
  </table>
</form>
去down.zzzyk.com教程下载一个phpmailer源码教程

require("mail/class.phpmailer.php"); 
 
 $mail = new PHPMailer(); 
 $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 = "人才自荐";
 $Subject =PostGet('tel',1);
 $jmail =PostGet('mail',1);
 $body =PostGet('bodys',1);
  $array ='zjj@oeoa.cn';
  
  $mail->AddReplyTo("mailangel123@163.com", "此邮箱无需回复!");
  $mail->AddAddress($array,'您好!');
  $mail->WordWrap = 50;
  $mail->CharSet="GB2312";                                  // set word wrap to 50 characters
  //$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
  //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
  $mail->IsHTML(true);                                  // set email format to HTML
  
  $mail->Subject = $Subject;
  $mail->Body    = $body.'<br>'.$jmail;
  //$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
  
  if(!$mail->Send())
  {
     echo "Message could not be sent. <p>";
     echo "Mailer Error: " . $mail->ErrorInfo;
     $mail->ClearAddresses();  
     $mail->ClearAttachments();
    
  }
  else
  {
   echo "您好,你的信息己经发送到我们负责人信箱,请等候佳声。<a href="javascript教程:window.close();">点击

关闭</a>";
  }

  
 
 /* echo "<script>alert('发关".$count."邮件成功');</script>"; */

?>
// 本站原创转载注明来源www.zzzyk.com

补充:Php教程,邮件处理 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,