php 利用phpmailer 線上發送郵件

來源:互聯網
上載者:User

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>&nbsp;</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.111cn.net教程下載一個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.111cn.net

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.