ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

12-2-3 ¦Û°Ê°e«Hµ{¦¡

12-2-3 ¦Û°Ê°e«Hµ{¦¡

12-2-3   ¦Û°Ê°e«Hµ{¦¡
·í°Ý¨÷¶ñ¼gªÌ¦bin.phpµ{¦¡ºô­¶¤¤«ö¤U¡y°e¥X°Ý¨÷¡z«ö¶s«á¡Aªí³æ¤¤ªº¸ê®Æ´N·|°e¥æ¦Û°Ê°e«Hµ{¦¡sentmsg.php³B²z¡Asentmsg.phpµ{¦¡±N·|§â°Ý¨÷¶ñ¼gµ²ªG»P¶ñ¼gªÌªº¸ê®Æ¥HE-Mail¦Û°Ê¶Ç°eªº¤è¦¡±H°e¦ÜºÞ²zªÌ©Î¬O°Ý¨÷½Õ¬d¥D«ù¤Hªº¤â¤¤¡C

¦b«H¥ó¶Ç°e¤§«e¡A§Ú­Ì¥²¶·¥ý³]©wmail()¨ç¼Æªº¦¬¥ó¤H(To)¡B±H¥ó¤H(From)¡B«H¥ó¥D¦®(Subject)»P«H¥ó¤º®e(Body)µ¥¥|¶µÄÝ©Ê¡A«H¥ó¥D¦®§Ú­Ì¥i¥H¦Û¦æ³]©w¬°©T©w¤å¦r¡A¦¬¥óªÌ«h¬°ºÞ²zªÌ©Î¬O°Ý¨÷½Õ¬d¥D«ù¤HªºE-Mail±b¸¹(³o¤]¬O©T©wªº)¡A«H¥ó¶Ç°eªº±H¥óªÌ»P«H¥ó¤º®e(°Ý¨÷µ²ªG)«h¬OÀHµÛ°Ý¨÷¶ñ¼gªÌ©Ò¶ñ¼gªº¤º®e¦ÓÅÜ°Ê¡C
  1. //«Ø¥ß¶l¥ó°ò¥»¶µ¥Ø       
  2.     //¥H°Ý¨÷µ{¦¡ºô­¶¤¤©Ò¶ñ¼gªºE-mail¬°±H¥óªÌ
  3.     $From= "From: " . $_REQUEST["Email"];
  4.     //¦¬¥óªÌ¬°ºÞ²z­û©Î°Ý¨÷½Õ¬d¥D«ù¤HªºE-Mail
  5.     $To= $_REQUEST["Email"];
  6.     //«H¥ó¥DÃD,³q±`¬°°Ý¨÷ªº¥DÃD
  7.     $Subject="ºô¸ô°Ý¨÷½Õ¬d";
  8.     //«H¥ó¤º®e
  9.     $Body = "ºô¤Í" . $_REQUEST["Name"] . "°Ý¨÷·N¨£¡G" . "\r\n"; //¥H¤U²¤¡K.
½Æ»s¥N½X
½ÐÆ[¹î¤W¦C³o¬qµ{¦¡±Ô­z¡A±z¥i¥H²M·¡ªº¬Ý¨ì§Ú­ÌFrom¡]±H¥óªÌ¶l¥ó«H½c¡^ÄݩʭȬO³]©w¬°¡G°Ý¨÷¶ñ¼gªÌ¦bin.phpµ{¦¡ºô­¶¤¤EmailÄæ¦ì¤¤©Ò¶ñ¼gªº¶l¥ó«H½c¡A³o»ò°µ³Ì¥D­nªº¥Øªº¬O¬°¤FÅýºÞ²zªÌ©Î¬O°Ý¨÷½Õ¬d¥D«ù¤H¯à°÷§Y®Éªº¥HE-Mail¤è¦¡¦^À³°Ý¨÷¶ñ¼gªÌ©Ò´£¥Xªº·N¨£¡C



´£¥Ü¡I¡I
¥»½d¨Ò¤¤From(±H¥óªÌ¶l¥ó«H½c)»PTo(¦¬¥óªÌ¶l¥ó«H½c)Äݩʭȳ]©w¬O¬Û¦Pªº¡A¤]´N¬O¦Û¤v±H«Hµ¹¦Û¤v¡A¦b¹ê»ÚÀ³¥Î®É½Ð¦Û¦æ§ó§ïTo(¦¬¥óªÌ¶l¥ó«H½c)Äݩʭȳ]©w¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

¦b«H¥ó¤º®eªº³¡¤À¡A°£¤F­n¦³°Ý¨÷¶ñ¼gªÌ©Ò¿ï¾Üªºµª®×»P·N¨£¥~¡A¥»½d¨Ò¤¤ÁÙ¥[¤W¬Û¹ïÀ³ªº°Ý¨÷ÃD¥Ø¥»¤å¡A¦pªG¤£¥[¤W­ì©lÃD¥Øªº¤º®e¡A§Ú­Ì«ç¯àª¾¹Dµª®×ªº·N¸q¡H
  1. //¦C¥X°Ý¨÷ÃD¥Ø¤Î°Ý¨÷¶ñ¼gªÌªºµª®×
  2.      $I=1;
  3.     while (($fielddatas=mysql_fetch_array($datalist)))
  4.     {
  5.      //¦C¥X°Ý¨÷ÃD¥Ø
  6.      $Body = $Body . $I . ". " . $fielddatas["ÃD¥Ø"] . "\r\n";
  7.      //¨ú±o¬Û¹ïÀ³©óÃD¥Øªº°Ý¨÷µª®×
  8.      $Ans=$_REQUEST["No" . $fielddatas["ÃD¸¹"]];
  9.      //¦C¥Xµª®×
  10.      $Body = $Body . $Ans . "\r\n";
  11.      $I++;
  12.     }
  13.    
  14. // ±H¥X«H¥ó
  15.     mail($To ,$Subject ,$Body ,$From);
½Æ»s¥N½X
1.¨Ï¥ÎWhile°j°é±Ô­z°t¦X§ïÅܧ@¥Î¤¤¸ê®Æ¿ý¦ì¸m»P´£¨ú¸ê®Æªºmysql_fetch_array()¨ç¼Æ¡A±N©Ò¦³ªº°Ý¨÷ÃD¥Ø¦Û¸ê®Æ®w¸ê®Æªí¤¤Åª¨ú¥X¨Ó¡C
2.§Q¥Î$_REQUEST[¡§ªí³æÄæ¦ì¡¨]±Ô­z¨ú±o¨Ó¦Û°Ý¨÷µ{¦¡ºô­¶¤¤¬Û¹ï©óÃD¥Øªºµª®×Äæ¦ìÄÝ©Ê­È(Value)¡C
3.©I¥smail()¨ç¼Æ±N«H¥ó±H¥X¡C



´£¥Ü¡I¡I
µ{¦¡½X¤¤ªº¡u\r\n¡v¬°¤@´«¦æ²Å¸¹¡A¨ä§@¥Î´N¬O±N§Ú­Ìªº«H¥ó¤º®e¤À¬qÅã¥Ü¡I­Y¥¼¥[¤W¦¹´«¦æ²Å¸¹¡A«h§Ú­Ìªº«H¥ó¤º®e±N·|¥þ³¡¦ê±µ¦¨¤@­Ó¬q¸¨¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

sentmsg.php
  1. <?
  2. //³sµ²MySQL Server
  3.     $conn = mysql_connect("localhost", "root", "12345a");
  4. //¿ï¾Ü¸ê®Æ®w
  5.     mysql_select_db("QUESTION", $conn);
  6. //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  7.     mysql_query("set character set big5");  
  8. //«Ø¥ß¬d¸ß¦r¦ê
  9. $SQL="Select * From question Order By ÃD¸¹";
  10. //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
  11. $datalist=mysql_query($SQL);
  12.                         
  13. //«Ø¥ß¶l¥ó°ò¥»¶µ¥Ø       
  14.     //¥H°Ý¨÷µ{¦¡ºô­¶¤¤©Ò¶ñ¼gªºE-mail¬°±H¥óªÌ
  15.     $From= "From: " . $_REQUEST["Email"];
  16.     //¦¬¥óªÌ¬°ºÞ²z­û©Î°Ý¨÷½Õ¬d¥D«ù¤HªºE-Mail
  17.     $To= $_REQUEST["Email"];
  18.     //«H¥ó¥DÃD,³q±`¬°°Ý¨÷ªº¥DÃD
  19.     $Subject="ºô¸ô°Ý¨÷½Õ¬d";
  20.     //«H¥ó¤º®e
  21.     $Body = "ºô¤Í" . $_REQUEST["Name"] . "°Ý¨÷·N¨£¡G" . "\r\n";
  22.    
  23. //¦C¥X°Ý¨÷ÃD¥Ø¤Î°Ý¨÷¶ñ¼gªÌªºµª®×
  24.      $I=1;
  25.     while (($fielddatas=mysql_fetch_array($datalist)))
  26.     {
  27.      //¦C¥X°Ý¨÷ÃD¥Ø
  28.      $Body = $Body . $I . ". " . $fielddatas["ÃD¥Ø"] . "\r\n";
  29.      //¨ú±o¬Û¹ïÀ³©óÃD¥Øªº°Ý¨÷µª®×
  30.      $Ans=$_REQUEST["No" . $fielddatas["ÃD¸¹"]];
  31.      //¦C¥Xµª®×
  32.      $Body = $Body . $Ans . "\r\n";
  33.      $I++;
  34.     }
  35.    
  36. // ±H¥X«H¥ó
  37.     mail($To ,$Subject ,$Body ,$From);
  38. ?>
  39. <html>
  40. <head>
  41. <meta http-equiv="Content-Type" content="text/html; chaRSet=big5">
  42. <title>·PÁ±zªº·N¨£!!</title>
  43. </head>
  44. <body>
  45. ·PÁ±zªº·N¨£
  46. </body>
  47. </html>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¨Ï¥ÎCDONTSª«¥ó±H°e°Ý¨÷µ²ªG
¬°¤F¤£ÅU¦¹Á¡©¼¡Aµ§ªÌ¤]¼g¤F§Q¥ÎCDONTS_NewMailª«¥ó±H°e°Ý¨÷µ²ªGªº½d¨Òµ{¦¡¡G¡usentmsg_cdonts.php¡v¡Aµ{¦¡³]­p­ì²z»Psentmsg.php¬Û¦P¡A¦]¦¹´N¤£¦h¨¥¤F¡A¦¹½d¨Òµ{¦¡½Ð°t¦X¡uin_cdonts.php¡v¨Ï¥Î¡C
  1. <?
  2. //³sµ²MySQL Server
  3.     $conn = mysql_connect("localhost", "root", "12345a");
  4. //¿ï¾Ü¸ê®Æ®w
  5.     mysql_select_db("QUESTION", $conn);
  6. //«ü©w´£¨ú¸ê®Æªº®Õ¹ï¦r¤¸ªí
  7.     mysql_query("set character set big5");  
  8. //«Ø¥ß¬d¸ß¦r¦ê
  9. $SQL="Select * From question Order By ÃD¸¹";
  10. //±N¦^¶Çµ²ªG¦s©ñ©óÅܼƤ¤
  11. $datalist=mysql_query($SQL);

  12. //«Ø¥ß«H¥ó¶Ç°eª«¥ó
  13. $CDONTS = new COM("CDONTS.NewMail");

  14. //«Ø¥ß¶l¥ó°ò¥»¶µ¥Ø       
  15.     //¥H°Ý¨÷µ{¦¡ºô­¶¤¤©Ò¶ñ¼gªºE-mail¬°±H¥óªÌ
  16.     $CDONTS->From=$_REQUEST["Email"];
  17.     //¦¬¥óªÌ¬°ºÞ²z­û©Î°Ý¨÷½Õ¬d¥D«ù¤HªºE-Mail
  18.     $CDONTS->To= $_REQUEST["Email"];
  19.     //«H¥ó¥DÃD,³q±`¬°°Ý¨÷ªº¥DÃD
  20.     $CDONTS->Subject="ºô¸ô°Ý¨÷½Õ¬d";
  21.     //«H¥ó¤º®e
  22.     $Body = "ºô¤Í" . $_REQUEST["Name"] . "°Ý¨÷·N¨£¡G";
  23.    
  24. //¦C¥X°Ý¨÷ÃD¥Ø¤Î°Ý¨÷¶ñ¼gªÌªºµª®×
  25.      $I=1;
  26.     while (($fielddatas=mysql_fetch_array($datalist)))
  27.     {
  28.      //¦C¥X°Ý¨÷ÃD¥Ø
  29.      $Body =$Body . "\r\n" . $I . ". " . $fielddatas["ÃD¥Ø"] . "\r\n";
  30.      //¨ú±o¬Û¹ïÀ³©óÃD¥Øªº°Ý¨÷µª®×
  31.      $Ans=$_REQUEST["No" . $fielddatas["ÃD¸¹"]];
  32.      //¦C¥Xµª®×
  33.      $Body = $Body . $Ans ;
  34.      $I++;
  35.     }

  36.     $CDONTS->Body=$Body;
  37. // ±H¥X«H¥ó
  38.     $CDONTS->Send();
  39. ?>
  40. <html>
  41. <head>
  42. <meta http-equiv="Content-Type" content="text/html; chaRSet=big5">
  43. <title>·PÁ±zªº·N¨£!!</title>
  44. </head>
  45. <body>
  46. ·PÁ±zªº·N¨£
  47. </body>
  48. </html>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD