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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// fonction d'envoi de Mail
function Envoi_mail($from,$to,$subject,$message){
$eol="\n";
$headers ='From: '.$from.$eol;
$headers.='Return-Path: '.$from.$eol;
$headers.='Reply-To: '.$from.$eol;
$headers.='X-Priority: 3'.$eol;
$headers.='X-Mailer: PHP/'.phpversion().$eol;
$headers.='MIME-Version: 1.0'.$eol;
$headers.='Content-Type: text/html; charset="ISO-8859-1"'.$eol;
$headers.='Content-Transfer-Encoding: base64'.$eol.$eol;
$msg=chunk_split(base64_encode($message));
$obj='=?ISO-8859-1?B?'.base64_encode($subject).'?=';
return (bool)@mail($to,$obj,$msg,$headers);
}
// Test
$message = "<html>
<head></head>
<body>
Bonjour !<br>
<table>
<tr>
<td>Etudiants</td>
<td>cin</td>
</tr>
<tr>
<td>C</td>
<td></td>
</tr>
<tr>
<td>G</td>
<td></td>
</tr>
<tr>
<td>M</td>
<td></td>
</tr>
<tr>
<td>B</td>
<td></td>
</tr>
</table>
</body>
</html>";
if(Envoi_mail('webmaster@etudiant.com', 'developppez@yahoo.fr', 'le sujet email1', $message))
$message='Message envoyé';
else
$message='Erreur ! Le message n\'a pas été envoyé';
echo $message;
?>
</body>
</html> |