Sur mon site, on peut s'inscrire à une formation. Jusque là, tout roule. Mais dans la foulée, j'aimerais que la personne reçoive un mail de confirmation. Pourriez-vous m'aider à y voir plus clair dans ce code (qui ne fonctionne pas...) ?
$objet = "Confirmation d'inscription monentreprise";
$boundary = '-----=' . md5(uniqid(rand()));
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$headers .= 'Content-Type:image/jpg; name="barre.jpg"';
$headers .= 'Content-Transfer-Encoding: base64';
$headers .= 'Content-Disposition: attachment; filename="../images/barre.jpg"';
$headers .= "From: monentreprise<[email protected]>\r\nReply-to : [email protected]";
$from = 'MIME-Version: 1.0\r\n';
$from .= 'Content-type: text/html; charset=iso-8859-1\r\n';
$from .= 'From: [email protected] <monentreprise>\r\nReply-to : [email protected] <monentreprise>\nX-Mailer:PHP';
$objet = "Confirmation d'inscription monentreprise";
$From = "From:[email protected]\n";
$From .= "MIME-version: 1.0\n";
$From .= "Content-type: text/html; charset= iso-8859-1\n";
$message = "Mon message";
ini_set("memory_limit",'2000M');
$file = fopen("mail.html","r");
if ($file){
while(!feof($file)){
$message .= $message.fgets($file, 4096);
}
fclose($file);
}
if (mail($UnEmail,$objet,$message,$From)){
$_SESSION['inscription'] = $UnPrenom.' '.$UnNom;
echo '<meta http-equiv="Refresh" content="0;URL=csc_formation.php">';
}
unset($Sql);
Les messages d'erreurs sont les suivants :-Warning : Fopen (mail.html) [Function.Fopen] : Failed to open stream : no such file or directory in...
-Warning : Mail() [Function mail] : Failed to connect to mailserver at "localhost" port 80, verify your "SMTP" and "SMTP_port" setting in php.ini or use ini_set in...
-Fatal error : Maximum execution time of 30 seconds exceeded in...