Bonjour à tous,

Je souhaite envoyer un mail au format html.

J'ai trouver un exemple sur cette page : http://a-pellegrini.developpez.com/t...php/mail/#L3.3

Je souhaite utiliser ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 
// To
$to = 'truc@server.com';
 
// Subject
$subject = 'Developpez.com - Test Mail';
 
// clé aléatoire de limite
$boundary = md5(uniqid(microtime(), TRUE));
 
// Headers
$headers = 'From: Adrien Pellegrini <mail@server.com>'."\r\n";
$headers .= 'Mime-Version: 1.0'."\r\n";
$headers .= 'Content-Type: multipart/mixed;boundary='.$boundary."\r\n";
$headers .= "\r\n";
 
// Message
$msg = 'This is a multipart/mixed message.'."\r\n\r\n";
 
// Texte
$msg .= '--'.$boundary."\r\n";
$msg .= 'Content-type:text/plain;charset=utf-8'."\r\n";
$msg .= 'Content-transfer-encoding:8bit'."\r\n";
$msg .= 'Un message avec une pièce jointe.'."\r\n";
 
// Pièce jointe
$file_name = 'image.jpg';
if (file_exists($file_name))
{
	$file_type = filetype($file_name);
	$file_size = filesize($file_name);
 
	$handle = fopen($file_name, 'r') or die('File '.$file_name.'can t be open');
	$content = fread($handle, $file_size);
	$content = chunk_split(base64_encode($content));
	$f = fclose($handle);
 
	$msg .= '--'.$boundary."\r\n";
	$msg .= 'Content-type:'.$file_type.';name='.$file_name."\r\n";
	$msg .= 'Content-transfer-encoding:base64'."\r\n";
	$msg .= $content."\r\n";
}
 
// Fin
$msg .= '--'.$boundary."\r\n";
 
// Function mail()
mail($to, $subject, $msg, $headers);

Jusque là, pas de problème. Mais je voudrais en plus y ajouter du php, pour y insérer les datas de mon panier virtuel.
Est-ce possible ?

Merci

Merci.