Bonjour,
Voici un script d'envoi d'email avec pièce jointe.
Celui-ci fonctionne qu'à moitié.
Lorsque la pièce jointe fait 25 Ko je n'ai aucun soucis, mais dès que cela atteind 1.5 Mo, sa plante.
Quelqu'un pourrait m'aider, parce la je voit pas pourquoi sa bug ?!!!!
Merci
Code PHP :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
<body>
<?
$mess = $_POST['mess'];
if (is_uploaded_file($monfichier)) {
$file = fopen($monfichier, "r");
$contents = fread($file, $monfichier_size);
$encoded_monfichier = chunk_split(base64_encode($contents));
fclose($file);
$entetes.= "MIME-version: 1.0\n";
$entetes.= "Content-type: multipart/mixed; ";
$entetes.= "boundary=\"Message-Boundary\"\n";
$entetes.= "Content-transfer-encoding: 7BIT\n";
$entetes.= "From: webmaster@dudul.fr";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$body_top .= "Sujet : Candidature \n\n";
$body_top .= "Nom : $from2 \n";
$body_top .= "Prenom : $from3 \n";
$body_top .= "E-mail : $from \n\n";
$body_top .= "Message : $mess \n";
$to ="zaza@sfr.fr" ;
$sujet="Candidature au recrutement";
$msg .= "\n\n--Message-Boundary\n";
$msg .= "Content-type: $monfichier_type; name=\"$monfichier_name\"\n";
$msg .= "Content-Transfer-Encoding: BASE64\n";
$msg .= "Content-disposition: attachment; filename=\"$monfichier_name\"\n\n";
$msg .= "$encoded_monfichier\n";
$msg .= "--Message-Boundary--\n";
}
$msg = $body_top.stripslashes($msg);
if (mail($to,$sujet,$msg, $entetes))
{
header('Location: recrutementok.php');
}
else
{
header('Location: recrutementerreur.php');
}
?>