pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

PHP paste-bin - collaborative debugging tool View Help


Posted by Kud on Mon 30th Apr 02:15
download | new post

  1. <?php /*
  2.  
  3. include('config.php');
  4.  
  5. $objet = 'Premier test !';
  6. $corps = "C'est un premier test d’envoi d’un email en php.\n" ;
  7. $corps .= "Ceci est la forme la plus simple de l’emploi de la fonction mail() \n";
  8. $headers ='From: "Kud"<[email protected]>'."\r\n";
  9. $headers .='Reply-To: [email protected]'."\r\n";
  10. $headers .='Content-Type: text/html; charset="iso-8859-1"'."\r\n";
  11. $headers .='Content-Transfer-Encoding: 8bit'."\r\n";
  12. $headers .='X-Mailer: PHP/' . phpversion();
  13.  
  14. $sql = "SELECT * from compte where com_id != " . $_SESSION['id'];
  15. $result = pg_query($sql);
  16. while ($destinataire = pg_fetch_array($result))
  17.         {
  18.         mail($destinataire['com_courriel'], $objet, $corps, $headers);
  19.         }
  20. */?>
  21.  
  22. <?php
  23.  
  24. // multiple recipients
  25. $to  = '[email protected]' . ', '; // note the comma
  26.  
  27. // subject
  28. $subject = 'Birthday Reminders for August';
  29.  
  30. // body
  31. $body = '
  32. <html>
  33. <head>
  34.   <title>Birthday Reminders for August</title>
  35. </head>
  36. <body>
  37.   <p>Here are the birthdays upcoming in August!</p>
  38.   <table>
  39.     <tr>
  40.       <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
  41.     </tr>
  42.     <tr>
  43.       <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
  44.     </tr>
  45.     <tr>
  46.       <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
  47.     </tr>
  48.   </table>
  49. </body>
  50. </html>
  51. ';
  52.  
  53. // To send HTML mail, the Content-type header must be set
  54. $headers  = 'MIME-Version: 1.0' . "\r\n";
  55. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  56.  
  57. // Additional headers
  58. $headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
  59. $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
  60. $headers .= 'Cc: [email protected]' . "\r\n";
  61. $headers .= 'Bcc: [email protected]' . "\r\n";
  62.  
  63. // Mail it
  64. mail($to, $subject, $body, $headers);
  65. ?>

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Use syntax highlighting

To highlight particular lines, prefix each line with @@
:
:
Remember my settings