国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > PHP > 正文

php PEAR mail發(fā)送郵件實例

2024-05-04 21:47:36
字體:
供稿:網(wǎng)友

phppear mail發(fā)送郵件實例

  1. --> 
  2. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"
  3. <html xmlns="http://www.w3.org/1999/xhtml"
  4. <head> 
  5. <meta http-equiv="content-type" content="text/html; charset=gb2312" /> 
  6. <title>php發(fā)送郵件</title> 
  7. </head> 
  8. <body> 
  9. <table width="611" height="200" border="1"
  10.   <tr> 
  11.     <td width="601"><form id="form1" name="form1" method="post" action="send.php"
  12.       <table width="600" height="240" border="0" cellpadding="0" cellspacing="0"
  13.         <tr> 
  14.           <td width="102" height="28">收件人地址</td> 
  15.           <td width="213"><input name="to" type="text" id="to" /></td> 
  16.           <td width="84">發(fā)送人地址</td> 
  17.           <td width="201"><input name="from" type="text" id="from" value="cert@163.com" /></td> 
  18.         </tr> 
  19.         <tr> 
  20.           <td height="33">發(fā)送人用戶名</td> 
  21.           <td><input name="name" type="text" id="username" value="cert" /></td> 
  22.           <td>郵箱密碼</td> 
  23.           <td><input name="password" type="password" id="password" value="***" /></td> 
  24.         </tr> 
  25.         <tr> 
  26.           <td height="27">smtp服務(wù)器</td> 
  27.           <td><input name="smtp" type="text" id="smtp" value="smtp.163.com" /></td> 
  28.           <td colspan="2">注:163郵箱smtp為: smtp.163.com</td> 
  29.           </tr> 
  30.         <tr> 
  31.           <td height="26">標(biāo)題</td> 
  32.           <td colspan="3"><input name="subject" type="text" id="subject" value="cert測試php發(fā)送郵件" size="50" /></td> 
  33.           </tr> 
  34.         <tr> 
  35.           <td height="69">內(nèi)容</td> 
  36.           <td colspan="3"><textarea name="content" cols="50" rows="6" id="content">計算機緊急響應(yīng)組歡迎你! 
  37. http://m.survivalescaperooms.com 
  38. 組織網(wǎng)站即將進(jìn)行改版</textarea></td> 
  39.           </tr> 
  40.         <tr> 
  41.          
  42.           <td>&nbsp;</td> 
  43.           <td align="right"><input type="submit" name="submit" value="發(fā)送" /></td> 
  44.           <td>&nbsp;</td> 
  45.           <td>&nbsp;</td> 
  46.         </tr> 
  47.       </table> 
  48.         <p>說明:我用163的郵箱發(fā)給 163 或 126 的郵箱立刻就能收到。大家試試。</p> 
  49.     </form> 
  50.     </td> 
  51.   </tr> 
  52. </table> 
  53. </body> 
  54. </html> 
  55. <? 
  56. require_once 'mail.php'
  57. $conf['mail'] = array(  
  58.         'host'     => 'smtp.126.com',                  //smtp服務(wù)器地址  
  59.         'auth'     => true,                           //true表示smtp服務(wù)器需要驗證,false不需要  
  60.         'username' => 'liangbowen',                   //用戶名  
  61.         'password' => '******'                        //密碼  
  62. ); 
  63.  
  64. //發(fā)送郵件 
  65. $headers['from']    = 'liangbowen@126.com';               //發(fā)信地址  
  66. $headers['to']      = 'liangbowen@hotmail.com';               //收信地址  
  67. $headers['subject'] = 'test mail send by php bowen.mvbb.com';   //郵件標(biāo)題  
  68. $mail_object = &mail::factory('smtp'$conf['mail']);     
  69. //郵件正文  
  70. $body = "這是一封自己發(fā)給自己的郵件。"
  71. $mail_res = $mail_object->send($headers['to'], $headers$body); //發(fā)送 
  72.                              
  73. if(pear::iserror($mail_res)){      //檢測錯誤 
  74.     die($mail_res->getmessage());  
  75. else
  76.  echo "send successful!"

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 通州市| 客服| 肇源县| 新安县| 盐城市| 连江县| 玉屏| 定南县| 固始县| 金阳县| 雷波县| 东乡族自治县| 建水县| 清涧县| 和林格尔县| 丰原市| 贵港市| 临洮县| 石泉县| 黔江区| 永和县| 瑞安市| 岳池县| 荥阳市| 长宁县| 德格县| 西吉县| 星子县| 江门市| 南澳县| 红安县| 桂阳县| 新安县| 巴林左旗| 莱阳市| 辉南县| 彝良县| 东海县| 望奎县| 尼玛县| 汕头市|