[ Index ]

PHP Cross Reference of IEUF

title

Body

[close]

/mail_fic/ -> index.php (source)

   1  <!DOCTYPE html>
   2  <html>
   3    <head>
   4  <?php
   5  function TraiteFic($nomfic) {
   6    if (!file_exists($nomfic)) die("Fichier non trouvé :".$nomfic);
   7    return chunk_split(base64_encode(file_get_contents($nomfic)));
   8  }
   9  ?>
  10      <title>Message avec fichiers joints</title>
  11      <meta content="text/html; charset=utf-8" http-equiv="content-type">
  12      <style type="text/css">
  13  h1 {
  14    font-family: Arial, Helvetica, sans-serif;
  15  }
  16  h2 {
  17    font-family: Arial, Helvetica, sans-serif;
  18  }
  19  </style></head>
  20    <body>
  21  <?php
  22  $expediteur= "jm@chapellut.fr";
  23  $adr_ret= $expediteur;
  24  $destinataires= "jean-michel@chapellut.fr, info@chapellut.fr";
  25  $dest_cc= "jmichel.chapellut@wanadoo.fr";
  26  $dest_cci= "jm.chapellut@orange.fr";
  27  $sujet= "Message avec fichiers joints";
  28  
  29  $header= "";
  30  $header .= "From: $expediteur\nReply-To: $adr_ret\n";
  31  $header .= "Cc: $dest_cc\n";
  32  $header .= "Bcc: $dest_cci\n";
  33  $header .= "MIME-Version: 1.0\n";
  34  $header .= "Content-Type: multipart/mixed;\n boundary=\"------------030902090600060100020901\"\n";
  35  $header .= "Content-Transfer-Encoding: 8bit\n\n";
  36  
  37  $corps= "";
  38  $corps .='
  39  This is a multi-part message in MIME format.
  40  --------------030902090600060100020901
  41  Content-Type: multipart/alternative;
  42   boundary="------------050508070903060100050502"
  43  
  44  
  45  --------------050508070903060100050502
  46  Content-Type: text/plain; charset=UTF8; format=flowed
  47  Content-Transfer-Encoding: 8bit
  48  
  49  Il était une fois
  50  
  51  --------------050508070903060100050502
  52  Content-Type: multipart/related;
  53   boundary="------------010608020802050801030402"
  54  
  55  
  56  --------------010608020802050801030402
  57  Content-Type: text/html; charset=UTF8
  58  Content-Transfer-Encoding: 8bit
  59  
  60  <html>
  61    <head>
  62      <meta http-equiv="content-type" content="text/html; charset=UTF8">
  63    </head>
  64    <body bgcolor="#FFFFFF" text="#000000">
  65      Insère une image :<br>
  66      <img alt="" src="cid:part1.05010608.01060103@chapellut.fr"><br>
  67      Et un fichier.<br>
  68      FIN<br>
  69    </body>
  70  </html>
  71  
  72  --------------010608020802050801030402
  73  Content-Type: image/jpeg;
  74   name="adherents.jpg"
  75  Content-Transfer-Encoding: base64
  76  Content-ID: <part1.05010608.01060103@chapellut.fr>
  77  Content-Disposition: inline;
  78   filename="adherents.jpg"
  79  ';
  80  $corps .= "\n".TraiteFic("adherents.jpg");
  81  $corps .= '
  82  --------------010608020802050801030402--
  83  
  84  --------------050508070903060100050502--
  85  
  86  --------------030902090600060100020901
  87  Content-Type: application/pdf;
  88   name="texte.pdf"
  89  Content-Transfer-Encoding: base64
  90  Content-Disposition: attachment;
  91   filename*0*=ISO-8859-1%44%6F%6E%6E%65%72%20%6C%61%20%70%72%69%6F%72%69;
  92   filename*1*=%74%E9%20%61%75%20%70%72%69%6D%61%69%72%65%2E%70%64%66
  93  ';
  94  $corps .= "\n".TraiteFic("texte.pdf");
  95  $corps .= '
  96  --------------030902090600060100020901--
  97  ';
  98  $result= mail ($destinataires, $sujet, $corps, $header);
  99  $msg_res= $result ? "a bien été envoyé" : "n'a pas été envoyé";
 100  ?>
 101      <h1>Le message <?php echo $msg_res; ?>.</h1>
 102      <h2>Destinataires</h2>
 103      <p><?php echo $destinataires; ?></p>
 104      <h2>Sujet</h2>
 105      <p><?php echo $sujet; ?></p>
 106      <h2>En-tête</h2>
 107      <pre>
 108      <?php
 109      echo $header;
 110      ?>
 111      </pre>
 112      <pre>
 113      <h2>Corps</h2>
 114      <?php
 115      echo $corps;
 116      ?>
 117      </pre>
 118    </body>
 119  </html>


Generated: Fri Jan 31 19:59:00 2014 Cross-referenced by PHPXref 0.7.1