Bonjour a tous,
voila je suis stagiaire et je fais un petit site intranet qui va utiliser une fonction envoie de mail.
Pour l'instant je test le script avec un fichier doc mais je compte faire ça avec du PDF
Le site fonctionne avec Easy php3.0
voici le script
<?php
$boundary='didondinaditondelosdudosdodudundodudindon';
//En-têtes du mail
$headers="From: relance@fnac.fr\r\n
MIME-Version: 1.0\r\n
Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n\n";
//Corps du mail en commençant par le message principal
$body="salut ça va ?". $boundary ."\n
Content-Type: text/plain; charset=ISO-8859-1\r\n\n
Message principal du mail.\n\n";
/* Pièce jointe, on va dire que notre fichier s'appelle bidule.doc et qu'il se situe dans le répertoire courant */
$fichier=file_get_contents('FichiersTypes/test.doc');
/* On utilise aussi chunk_split() qui organisera comme il faut l'encodage fait en base 64 pour se conformer aux standards */
$fichier=chunk_split( base64_encode($fichier) );
//Fermeture de la frontière
$body = $body . "--" . $boundary ."--";
//Envoi du mail
mail("MonAdresse@yahoo.fr", "sujet", $body, $headers);
?>
j'ai paramétré easyphp, le mail part bien et je reçois sur ma boite yahoo mail mais voila ce que ça m'affiche
"
Content-Type: application/msword; name="test.doc"