Bonjours a tous,

Voilà après plusieurs lectures sur le php et la fonction mail, j'aurais voulu créer une petite page pour envoyer des mails "html" en php !!

Deux fichiers sur ce projet, le premier index.html et le deuxième mail.php

index.html
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<html>
<head>
<title>x2FuUk</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<form name="form1"  method="POST" action="mail.php">
 
<p>Email <input type="text" name="mail" value="e-mail"></p>
 
<p><input type="submit" name="envoyer" value="Envoyer"></p>
</form>
</body>
</html>

mail.php
Code php : 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
<?php
$email = 'Press-exclu@x2fuuk.fr';
$mail = $GLOBALS[mail]; 
 
$headers .='From: '.$email.''."\n"; 
$headers .='Reply-To: '.$mail.''."\n"; 
$headers .='Content-Type: text/html; charset="iso-8859-1"'."\n";
$headers .='Content-Transfer-Encoding: 8bit';
 
$message ='<html><head><title>x2fuuk.fr</title></head><body>
<table align="center" bgcolor="#CCCCCC" width="500">
<tr>
<td><hr align="JUSTIFY" />
  <div align="justify"><u>test</u><br>
   test , test , test , test , test 
  </div>
  <hr /></td></tr></table></body></html>'; 
 
if (mail($mail, 'Test de mail', $message, $headers)) {
	$resultat = 'mail envoyé.';
}
else {
	$resultat = 'mail pas envoyé';
}
 
echo $resultat;
?>