begin process at 2010 02 10 16:10:08
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

E-Mail / Messagerie

 > ENVOIE MAIL AVEC PIECES JOINTES QUI MARCHE AVEC TOUS LES HEBERGEURS (TESTE AVEC ONLINE)

ENVOIE MAIL AVEC PIECES JOINTES QUI MARCHE AVEC TOUS LES HEBERGEURS (TESTE AVEC ONLINE)


 Information sur la source

Note :
6,67 / 10 - par 3 personnes
6,67 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :E-Mail / Messagerie Niveau :Initié Date de création :24/03/2005 Date de mise à jour :07/05/2005 09:12:58 Vu :16 918

Auteur : mouajria

Ecrire un message privé
Commentaire sur cette source (27)
Ajouter un commentaire et/ou une note

 Description

bonjour

d'abord ce code n'est pas a moi, j'ai trouvé ce code dans le forum . mais il n'est pas fonctionnel . j'ai corrige ce code et je l'ai testé avec tous les types de fichiers comme piece jointes . et il est bien fonctionnel.

pour tester ce code il faut créer un repertoir upload dans le dossier qui contient vos pages.

ce code est teste sous online.
merci .

Source

  • 'formulaire d'envoie'
  • <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  • <html>
  • <head>
  • <title>Contact</title>
  • <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  • <style>
  • BODY {
  • SCROLLBAR-FACE-COLOR:#ffffff;
  • SCROLLBAR-HIGHLIGHT-COLOR: #B6B6B6;
  • SCROLLBAR-SHADOW-COLOR:#B6B6B6;
  • SCROLLBAR-3DLIGHT-COLOR: #F2F2F2;
  • SCROLLBAR-ARROW-COLOR: #B6B6B6 SCROLLBAR-TRACK-COLOR: #B6B6B6; SCROLLBAR-DARKSHADOW-COLOR:#B6B6B6;
  • background-image: url();
  • }
  • </style>
  • <style type="text/css">
  • <!--
  • <style type="text/css">
  • <!--
  • body {
  • margin-left: 0px;
  • margin-top: 2px;
  • margin-right: 0px;
  • margin-bottom: 0px;
  • background-image: url(gif/bg2.gif);
  • }
  • .normal {
  • font-size : 11pt;
  • padding-right : 10pt;
  • font-weight : normal;
  • left: 5pt;
  • padding-top: 10pt;
  • padding-bottom: 10pt;
  • padding-left: 10pt;
  • }
  • --></style>
  • <link href="css/txt.css" rel="stylesheet" type="text/css">
  • <link href="css/txtplus.css" rel="stylesheet" type="text/css">
  • <link href="style.css" rel="stylesheet" type="text/css">
  • <style type="text/css">
  • <!--
  • .Style4 {font-size: 11px}
  • .style13 {color: #99CC00}
  • .style14 { color: #FFFFFF;
  • font-weight: bold;
  • }
  • .style34 {font-size: 11px; font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; text-transform: capitalize; text-decoration: none; font-family: "Century Gothic";}
  • .style35 {font-size: 14px; font-style: normal; font-weight: bold; font-variant: bold; text-decoration: none; font-family: Geneva, Arial, Helvetica, san-serif;}
  • .style6 {font-family: Geneva, Arial, Helvetica, san-serif;
  • font-weight: bold;
  • color: #FFFFFF;
  • font-size: 14px;
  • }
  • .style7 {font-family: Geneva, Arial, Helvetica, san-serif}
  • .style36 {font-size: 12px}
  • .style39 {
  • font-family: Geneva, Arial, Helvetica, san-serif;
  • font-size: 12px;
  • font-weight: bold;
  • color: #006699;
  • }
  • .style41 {color: #006699}
  • .style45 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; color: #999999; }
  • .style48 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; }
  • .style51 {color: #666666}
  • .style53 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; color: #666666; }
  • .style54 {color: #666666; font-weight: bold; }
  • .style58 {color: #000000}
  • -->
  • </style>
  • </head>
  • <body bgcolor="#FFFFFF" text="#000000" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0" rightmargin="0" >
  • <strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong>
  • <table width="654" height="336" border="0" align="center" cellpadding="0" cellspacing="0">
  • <tr>
  • <td width="298" height="19" bgcolor="#3F8420"> <span class="style6"><span class="style13">&gt;&gt;</span><span class="style14"><span class="style34"><span class="style35">Contact</span></span></span>&nbsp;: <strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong></span></td>
  • <td width="124" bgcolor="#EEEEEE"><img src="imgs/tab.jpg" width="57" height="19"></td>
  • <td width="232" bgcolor="#EEEEEE"><span class="style7"></span></td>
  • </tr>
  • <tr align="left" valign="top">
  • <td height="317" colspan="5" background="imgs/index_04.jpg"><blockquote>
  • <form action="mail.php" method="post" name="form1">
  • <p align="center">&nbsp;</p>
  • <table width="172" border="0" align="left" cellpadding="0" cellspacing="0">
  • <tr>
  • <td width="172" bgcolor="#E2E2E2"><span class="style36 style7 style41"><strong><img width="7" height="10" src="competences_clip_image001_0001.gif"><span class="style58">Tunisie : </span></strong></span></td>
  • </tr>
  • <tr>
  • <td><span class="style45">T&eacute;l &nbsp;: +</span></td>
  • </tr>
  • <tr>
  • <td height="19"><span class="style45">Fax&nbsp;: +</span></td>
  • </tr>
  • <tr>
  • <td height="19"><span class="style45">Adresse:7,Av Taieb M'hiri</span></td>
  • </tr>
  • <tr>
  • <td height="19"><div align="left"><span class="style45"> Ariana 2080 Tunisie</span></div></td>
  • </tr>
  • <tr>
  • <td bgcolor="#E2E2E2"><span class="style39"><img width="7" height="10" src="competences_clip_image001_0001.gif"><span class="style58">France &nbsp;: </span></span></td>
  • </tr>
  • <tr>
  • <td><span class="style45">T&eacute;l &nbsp;:<FONT face=Arial><SPAN style="FONT-FAMILY: Arial">+<o:p></o:p></SPAN></FONT></span></td>
  • </tr>
  • <tr>
  • <td><span class="style45">Fax&nbsp;:<FONT face=Arial><SPAN style="FONT-FAMILY: Arial">+</SPAN></FONT></span></td>
  • </tr>
  • <tr>
  • <td class="style45"><div align="left">
  • <p align="justify">Adresse:<span class="MsoNormal"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> 8-10</SPAN></FONT></span>,Chemin Saint Gobain 69 190 -Saint-Fons Lyon- France </p>
  • </div></td>
  • </tr>
  • <tr>
  • <td height="15" bgcolor="#E2E2E2" class="style48"><p><img width="7" height="10" src="competences_clip_image001_0001.gif">Commerial&nbsp;</p>
  • </td>
  • </tr>
  • <tr>
  • <td><span class="style48"><a href="mailto:commercial@ascii-web.com" target="_blank"><span class="style54"> </span></a><span class="style51"></span></span></td>
  • </tr>
  • <tr>
  • <td bgcolor="#E2E2E2"><span class="style48"><img width="7" height="10" src="competences_clip_image001_0001.gif">Technique&nbsp;: <span class="style51"></span></span></td>
  • </tr>
  • <tr>
  • <td><span class="style48"><a href="mailto:support@ascii-web.com&#160;" target="_blank"><span class="style54">support@ascii-web.com&nbsp;</span></a> <span class="style51"></span></span></td>
  • </tr>
  • </table>
  • <table width="303" border="0" align="center" cellpadding="0" cellspacing="0">
  • <tr bgcolor="#F2F9FF">
  • <td width="73"><div align="right" class="style53">Nom:</div></td>
  • <td width="218"><input type="text" name="nom"></td>
  • </tr>
  • <tr>
  • <td><div align="right" class="style53">Pr&eacute;nom:</div></td>
  • <td><input type="text" name="prenom"></td>
  • </tr>
  • <tr bgcolor="#F2F9FF">
  • <td><div align="right" class="style53">Soci&eacute;t&eacute;:</div></td>
  • <td><input type="text" name="societe"></td>
  • </tr>
  • <tr>
  • <td><div align="right" class="style53">E-mail:</div></td>
  • <td><input type="text" name="mail"></td>
  • </tr>
  • <tr bgcolor="#F2F9FF">
  • <td><div align="right" class="style53">T&eacute;l:</div></td>
  • <td><input type="text" name="tel"></td>
  • </tr>
  • <tr>
  • <td><div align="right" class="style53">Fax:</div></td>
  • <td><input type="text" name="fax"></td>
  • </tr>
  • <tr bgcolor="#F2F9FF">
  • <td valign="top"><div align="right" class="style53">Message:</div></td>
  • <td><textarea name="message" cols="30" rows="3"></textarea>
  • </td>
  • </tr>
  • <tr bgcolor="#FFFFFF">
  • <td valign="top"><div align="right" class="style53">Pièce Jointe:</div></td>
  • <td valign="top"> <input type="file" name="fileattach" value=""></td>
  • </tr>
  • <tr bgcolor="#FFFFFF">
  • <td height="26" colspan="2"><div align="center">
  • <input type="reset" name="Reset" value="Annuler">
  • <input type="submit" name="Submit2" value="Envoyer">
  • </div></td>
  • </tr>
  • </table>
  • </form>
  • </blockquote></td>
  • </tr>
  • </table>
  • <strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong>
  • </body>
  • </html>
  • ///////////////////////////////// page mail.php
  • <?php
  • include "libmail.php";
  • $nom = $_POST['nom'];
  • $prenom = $_POST['prenom'];
  • $societe = $_POST['societe'];
  • $mail = $_POST['mail'];
  • $tel = $_POST['tel'];
  • $fax = $_POST['fax'];
  • $message = $_POST['message'];
  • $fileattach = $_POST['fileattach'];
  • $sujet="Test de mail";
  • $msg="prénom:$prenom \n nom:$nom \n société:$societe \n mail:$mail \n tel:$tel \n fax:$fax \n message: \n $message";
  • $m = new mail(); // create the mail
  • $m->From("webmaster");
  • $m->To("mouajria@yahoo.fr");
  • $m->Subject( "Mail Envoyé à partir du site " );
  • $m->Body($msg);
  • $m->Priority(4);
  • $patharray = explode ("\\", $fileattach);
  • $FileName=$patharray[count($patharray)-1];
  • echo $FileName;
  • if ("$FileName"!="") {
  • if (is_uploaded_file($HTTP_POST_FILES['fileattach'])) {
  • copy($HTTP_POST_FILES['fileattach'], "../upload/$FileName");
  • $m->Attach("../upload/$FileName");
  • } else {
  • echo "Tentative d'attaque possible : '$HTTP_POST_FILES[fileattach]'.";
  • }
  • //echo $FileName;
  • }
  • $m->Send();
  • if ("$FileName"!="") {
  • Unlink("../upload/$FileName");
  • }
  • echo "le mail a éte envoyé ";
  • ?>
  • ///////////////////////////la clsse libmail fichier : libmail.php
  • <?php
  • class Mail
  • {
  • /*
  • list of To addresses
  • @var array
  • */
  • var $sendto = array();
  • /*
  • @var array
  • */
  • var $acc = array();
  • /*
  • @var array
  • */
  • var $abcc = array();
  • /*
  • paths of attached files
  • @var array
  • */
  • var $aattach = array();
  • /*
  • list of message headers
  • @var array
  • */
  • var $xheaders = array();
  • /*
  • message priorities referential
  • @var array
  • */
  • var $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
  • /*
  • character set of message
  • @var string
  • */
  • var $charset = "us-ascii";
  • var $ctencoding = "7bit";
  • var $receipt = 0;
  • /*
  • Mail contructor
  • */
  • function Mail()
  • {
  • $this->autoCheck( true );
  • $this->boundary= "--" . md5( uniqid("myboundary") );
  • }
  • /*
  • activate or desactivate the email addresses validator
  • ex: autoCheck( true ) turn the validator on
  • by default autoCheck feature is on
  • @param boolean $bool set to true to turn on the auto validation
  • @access public
  • */
  • function autoCheck( $bool )
  • {
  • if( $bool )
  • $this->checkAddress = true;
  • else
  • $this->checkAddress = false;
  • }
  • /*
  • Define the subject line of the email
  • @param string $subject any monoline string
  • */
  • function Subject( $subject )
  • {
  • $this->xheaders['Subject'] = strtr( $subject, "\r\n" , " " );
  • }
  • /*
  • set the sender of the mail
  • @param string $from should be an email address
  • */
  • function From( $from )
  • {
  • if( ! is_string($from) ) {
  • echo "Class Mail: error, From is not a string";
  • exit;
  • }
  • $this->xheaders['From'] = $from;
  • }
  • /*
  • set the Reply-to header
  • @param string $email should be an email address
  • */
  • function ReplyTo( $address )
  • {
  • if( ! is_string($address) )
  • return false;
  • $this->xheaders["Reply-To"] = $address;
  • }
  • /*
  • add a receipt to the mail ie. a confirmation is returned to the "From" address (or "ReplyTo" if defined)
  • when the receiver opens the message.
  • @warning this functionality is *not* a standard, thus only some mail clients are compliants.
  • */
  • function Receipt()
  • {
  • $this->receipt = 1;
  • }
  • /*
  • set the mail recipient
  • @param string $to email address, accept both a single address or an array of addresses
  • */
  • function To( $to )
  • {
  • // TODO : test validité sur to
  • if( is_array( $to ) )
  • $this->sendto= $to;
  • else
  • $this->sendto[] = $to;
  • if( $this->checkAddress == true )
  • $this->CheckAdresses( $this->sendto );
  • }
  • /* Cc()
  • * set the CC headers ( carbon copy )
  • * $cc : email address(es), accept both array and string
  • */
  • function Cc( $cc )
  • {
  • if( is_array($cc) )
  • $this->acc= $cc;
  • else
  • $this->acc[]= $cc;
  • if( $this->checkAddress == true )
  • $this->CheckAdresses( $this->acc );
  • }
  • /* Bcc()
  • * set the Bcc headers ( blank carbon copy ).
  • * $bcc : email address(es), accept both array and string
  • */
  • function Bcc( $bcc )
  • {
  • if( is_array($bcc) ) {
  • $this->abcc = $bcc;
  • } else {
  • $this->abcc[]= $bcc;
  • }
  • if( $this->checkAddress == true )
  • $this->CheckAdresses( $this->abcc );
  • }
  • /* Body( text [, charset] )
  • * set the body (message) of the mail
  • * define the charset if the message contains extended characters (accents)
  • * default to us-ascii
  • * $mail->Body( "mél en français avec des accents", "iso-8859-1" );
  • */
  • function Body( $body, $charset="" )
  • {
  • $this->body = $body;
  • if( $charset != "" ) {
  • $this->charset = strtolower($charset);
  • if( $this->charset != "us-ascii" )
  • $this->ctencoding = "8bit";
  • }
  • }
  • /* Organization( $org )
  • * set the Organization header
  • */
  • function Organization( $org )
  • {
  • if( trim( $org != "" ) )
  • $this->xheaders['Organization'] = $org;
  • }
  • /* Priority( $priority )
  • * set the mail priority
  • * $priority : integer taken between 1 (highest) and 5 ( lowest )
  • * ex: $mail->Priority(1) ; => Highest
  • */
  • function Priority( $priority )
  • {
  • if( ! intval( $priority ) )
  • return false;
  • if( ! isset( $this->priorities[$priority-1]) )
  • return false;
  • $this->xheaders["X-Priority"] = $this->priorities[$priority-1];
  • return true;
  • }
  • /*
  • Attach a file to the mail
  • @param string $filename : path of the file to attach
  • @param string $filetype : MIME-type of the file. default to 'application/x-unknown-content-type'
  • @param string $disposition : instruct the Mailclient to display the file if possible ("inline") or always as a link ("attachment") possible values are "inline", "attachment"
  • */
  • function Attach( $filename, $filetype = "application/x-unknown-content-type", $disposition = "inline" )
  • {
  • // TODO : si filetype="", alors chercher dans un tablo de MT connus / extension du fichier
  • if( $filetype == "" )
  • $filetype = "application/x-unknown-content-type";
  • $this->aattach[] = $filename;
  • $this->actype[] = $filetype;
  • $this->adispo[] = $disposition;
  • }
  • /*
  • Build the email message
  • @access protected
  • */
  • function BuildMail()
  • {
  • // build the headers
  • $this->headers = "";
  • // $this->xheaders['To'] = implode( ", ", $this->sendto );
  • if( count($this->acc) > 0 )
  • $this->xheaders['CC'] = implode( ", ", $this->acc );
  • if( count($this->abcc) > 0 )
  • $this->xheaders['BCC'] = implode( ", ", $this->abcc );
  • if( $this->receipt ) {
  • if( isset($this->xheaders["Reply-To"] ) )
  • $this->xheaders["Disposition-Notification-To"] = $this->xheaders["Reply-To"];
  • else
  • $this->xheaders["Disposition-Notification-To"] = $this->xheaders['From'];
  • }
  • if( $this->charset != "" ) {
  • $this->xheaders["Mime-Version"] = "1.0";
  • $this->xheaders["Content-Type"] = "text/plain; charset=$this->charset";
  • $this->xheaders["Content-Transfer-Encoding"] = $this->ctencoding;
  • }
  • $this->xheaders["X-Mailer"] = "Php/libMailv1.3";
  • // include attached files
  • if( count( $this->aattach ) > 0 ) {
  • $this->_build_attachement();
  • } else {
  • $this->fullBody = $this->body;
  • }
  • reset($this->xheaders);
  • while( list( $hdr,$value ) = each( $this->xheaders ) ) {
  • if( $hdr != "Subject" )
  • $this->headers .= "$hdr: $value\n";
  • }
  • }
  • /*
  • fornat and send the mail
  • @access public
  • */
  • function Send()
  • {
  • $this->BuildMail();
  • $this->strTo = implode( ", ", $this->sendto );
  • // envoie du mail
  • $res = @mail( $this->strTo, $this->xheaders['Subject'], $this->fullBody, $this->headers );
  • }
  • /*
  • * return the whole e-mail , headers + message
  • * can be used for displaying the message in plain text or logging it
  • */
  • function Get()
  • {
  • $this->BuildMail();
  • $mail = "To: " . $this->strTo . "\n";
  • $mail .= $this->headers . "\n";
  • $mail .= $this->fullBody;
  • return $mail;
  • }
  • /*
  • check an email address validity
  • @access public
  • @param string $address : email address to check
  • @return true if email adress is ok
  • */
  • function ValidEmail($address)
  • {
  • if( ereg( ".*<(.+)>", $address, $regs ) ) {
  • $address = $regs[1];
  • }
  • if(ereg( "^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) )
  • return true;
  • else
  • return false;
  • }
  • /*
  • check validity of email addresses
  • @param array $aad -
  • @return if unvalid, output an error message and exit, this may -should- be customized
  • */
  • function CheckAdresses( $aad )
  • {
  • for($i=0;$i< count( $aad); $i++ ) {
  • if( ! $this->ValidEmail( $aad[$i]) ) {
  • echo "Class Mail, method Mail : invalid address $aad[$i]";
  • exit;
  • }
  • }
  • }
  • /*
  • check and encode attach file(s) . internal use only
  • @access private
  • */
  • function _build_attachement()
  • {
  • $this->xheaders["Content-Type"] = "multipart/mixed;\n boundary=\"$this->boundary\"";
  • $this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\n";
  • $this->fullBody .= "Content-Type: text/plain; charset=$this->charset\nContent-Transfer-Encoding: $this->ctencoding\n\n" . $this->body ."\n";
  • $sep= chr(13) . chr(10);
  • $ata= array();
  • $k=0;
  • // for each attached file, do...
  • for( $i=0; $i < count( $this->aattach); $i++ ) {
  • $filename = $this->aattach[$i];
  • $basename = basename($filename);
  • $ctype = $this->actype[$i]; // content-type
  • $disposition = $this->adispo[$i];
  • if( ! file_exists( $filename) ) {
  • echo "Class Mail, method attach : file $filename can't be found"; exit;
  • }
  • $subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n filename=\"$basename\"\n";
  • $ata[$k++] = $subhdr;
  • // non encoded line length
  • $linesz= filesize( $filename)+1;
  • $fp= fopen( $filename, 'r' );
  • $ata[$k++] = chunk_split(base64_encode(fread( $fp, $linesz)));
  • fclose($fp);
  • }
  • $this->fullBody .= implode($sep, $ata);
  • }
  • } // class Mail
  • ?>
'formulaire d'envoie'


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
BODY {
	SCROLLBAR-FACE-COLOR:#ffffff;
	SCROLLBAR-HIGHLIGHT-COLOR: #B6B6B6;
	SCROLLBAR-SHADOW-COLOR:#B6B6B6;
	SCROLLBAR-3DLIGHT-COLOR: #F2F2F2;
SCROLLBAR-ARROW-COLOR: #B6B6B6 SCROLLBAR-TRACK-COLOR: #B6B6B6; 	SCROLLBAR-DARKSHADOW-COLOR:#B6B6B6;
	background-image: url();
}
</style>


<style type="text/css">
<!--
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 2px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url(gif/bg2.gif);
}

.normal {
	font-size : 11pt;
	padding-right : 10pt;
	font-weight : normal;
	left: 5pt;
	padding-top: 10pt;
	padding-bottom: 10pt;
	padding-left: 10pt;
	
}
--></style>
<link href="css/txt.css" rel="stylesheet" type="text/css">
<link href="css/txtplus.css" rel="stylesheet" type="text/css">
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Style4 {font-size: 11px}
.style13 {color: #99CC00}
.style14 {	color: #FFFFFF;
	font-weight: bold;
}
.style34 {font-size: 11px; font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; text-transform: capitalize; text-decoration: none; font-family: "Century Gothic";}
.style35 {font-size: 14px; font-style: normal; font-weight: bold; font-variant: bold; text-decoration: none; font-family: Geneva, Arial, Helvetica, san-serif;}
.style6 {font-family: Geneva, Arial, Helvetica, san-serif;
	font-weight: bold;
	color: #FFFFFF;
	font-size: 14px;
}
.style7 {font-family: Geneva, Arial, Helvetica, san-serif}
.style36 {font-size: 12px}
.style39 {
	font-family: Geneva, Arial, Helvetica, san-serif;
	font-size: 12px;
	font-weight: bold;
	color: #006699;
}
.style41 {color: #006699}
.style45 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; color: #999999; }
.style48 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; }
.style51 {color: #666666}
.style53 {font-family: Geneva, Arial, Helvetica, san-serif; font-size: 12px; font-weight: bold; color: #666666; }
.style54 {color: #666666; font-weight: bold; }
.style58 {color: #000000}
-->
</style>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0" rightmargin="0" >
<strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong>
<table width="654" height="336" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="298" height="19" bgcolor="#3F8420"> <span class="style6"><span class="style13">&gt;&gt;</span><span class="style14"><span class="style34"><span class="style35">Contact</span></span></span>&nbsp;: <strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong></span></td>

  
    <td width="124" bgcolor="#EEEEEE"><img src="imgs/tab.jpg" width="57" height="19"></td>
    <td width="232" bgcolor="#EEEEEE"><span class="style7"></span></td>
  </tr>
  <tr align="left" valign="top">
    <td height="317" colspan="5" background="imgs/index_04.jpg"><blockquote>
	<form action="mail.php" method="post" name="form1">
          <p align="center">&nbsp;</p>
          <table width="172" border="0" align="left" cellpadding="0" cellspacing="0">
            <tr>
              <td width="172" bgcolor="#E2E2E2"><span class="style36 style7 style41"><strong><img width="7" height="10" src="competences_clip_image001_0001.gif"><span class="style58">Tunisie : </span></strong></span></td>
            </tr>
            <tr>
              <td><span class="style45">T&eacute;l &nbsp;: +</span></td>
            </tr>
            <tr>
              <td height="19"><span class="style45">Fax&nbsp;: +</span></td>
            </tr>
            <tr>
              <td height="19"><span class="style45">Adresse:7,Av Taieb M'hiri</span></td>
            </tr>
            <tr>
              <td height="19"><div align="left"><span class="style45"> Ariana 2080 Tunisie</span></div></td>
            </tr>
            <tr>
              <td bgcolor="#E2E2E2"><span class="style39"><img width="7" height="10" src="competences_clip_image001_0001.gif"><span class="style58">France &nbsp;: </span></span></td>
            </tr>
            <tr>
              <td><span class="style45">T&eacute;l &nbsp;:<FONT face=Arial><SPAN style="FONT-FAMILY: Arial">+<o:p></o:p></SPAN></FONT></span></td>
            </tr>
            <tr>
              <td><span class="style45">Fax&nbsp;:<FONT face=Arial><SPAN style="FONT-FAMILY: Arial">+</SPAN></FONT></span></td>
            </tr>
            <tr>
              <td class="style45"><div align="left">
                <p align="justify">Adresse:<span class="MsoNormal"><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> 8-10</SPAN></FONT></span>,Chemin Saint Gobain 69 190 -Saint-Fons Lyon- France </p>
              </div></td>
            </tr>
           
            <tr>
              <td height="15" bgcolor="#E2E2E2" class="style48"><p><img width="7" height="10" src="competences_clip_image001_0001.gif">Commerial&nbsp;</p>
              </td>
            </tr>
            <tr>
              <td><span class="style48"><a href="mailto:commercial@ascii-web.com" target="_blank"><span class="style54"> </span></a><span class="style51"></span></span></td>
            </tr>
            <tr>
              <td bgcolor="#E2E2E2"><span class="style48"><img width="7" height="10" src="competences_clip_image001_0001.gif">Technique&nbsp;: <span class="style51"></span></span></td>
            </tr>
            <tr>
              <td><span class="style48"><a href="mailto:support@ascii-web.com&#160;" target="_blank"><span class="style54">support@ascii-web.com&nbsp;</span></a> <span class="style51"></span></span></td>
            </tr>
          </table>
           <table width="303" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr bgcolor="#F2F9FF">
              <td width="73"><div align="right" class="style53">Nom:</div></td>
              <td width="218"><input type="text" name="nom"></td>
            </tr>
            <tr>
              <td><div align="right" class="style53">Pr&eacute;nom:</div></td>
              <td><input type="text" name="prenom"></td>
            </tr>
            <tr bgcolor="#F2F9FF">
              <td><div align="right" class="style53">Soci&eacute;t&eacute;:</div></td>
              <td><input type="text" name="societe"></td>
            </tr>
            <tr>
              <td><div align="right" class="style53">E-mail:</div></td>
			  <td><input type="text" name="mail"></td>
			      
            </tr>
            <tr bgcolor="#F2F9FF">
              <td><div align="right" class="style53">T&eacute;l:</div></td>
              <td><input type="text" name="tel"></td>
            </tr>
            <tr>
              <td><div align="right" class="style53">Fax:</div></td>
              <td><input type="text" name="fax"></td>
            </tr>
            <tr bgcolor="#F2F9FF">
              <td valign="top"><div align="right" class="style53">Message:</div></td>
              <td><textarea name="message" cols="30" rows="3"></textarea>
			
			  </td>
            </tr>
			<tr bgcolor="#FFFFFF">
			 <td valign="top"><div align="right" class="style53">Pièce Jointe:</div></td>
              <td valign="top">  <input type="file" name="fileattach" value=""></td>
			</tr>
            <tr bgcolor="#FFFFFF">
              <td height="26" colspan="2"><div align="center">
                  <input type="reset" name="Reset" value="Annuler">
                  <input type="submit" name="Submit2" value="Envoyer">
              </div></td>
            </tr>
          </table>
        </form>
    </blockquote></td>
  </tr>
</table>
<strong><font color="#FF9900"><span class="txtplus"><font color="#003366"><strong><font color="#FF9900"><font color="#003366"></font></font></strong></font></span></font></strong>
</body>
</html>




///////////////////////////////// page mail.php
<?php
  include "libmail.php";
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$societe = $_POST['societe'];
$mail = $_POST['mail'];
$tel = $_POST['tel'];
$fax = $_POST['fax'];
$message = $_POST['message'];
$fileattach = $_POST['fileattach'];
    $sujet="Test de mail";
    $msg="prénom:$prenom \n nom:$nom \n société:$societe \n mail:$mail \n tel:$tel \n fax:$fax \n message: \n $message";

$m = new mail(); // create the mail
$m->From("webmaster");
$m->To("mouajria@yahoo.fr");
$m->Subject( "Mail Envoyé à partir du site " );
$m->Body($msg);
$m->Priority(4);

  $patharray = explode ("\\", $fileattach);
   $FileName=$patharray[count($patharray)-1];
   echo $FileName;
  
if ("$FileName"!="") {

  if (is_uploaded_file($HTTP_POST_FILES['fileattach'])) {
   copy($HTTP_POST_FILES['fileattach'],  "../upload/$FileName");
   $m->Attach("../upload/$FileName");
} else {
   echo "Tentative d'attaque possible : '$HTTP_POST_FILES[fileattach]'.";
}

 //echo $FileName;
	}
        $m->Send(); 
if ("$FileName"!="") {
Unlink("../upload/$FileName");  
}    



	echo "le mail a éte envoyé ";

 ?>



///////////////////////////la clsse libmail fichier : libmail.php


<?php
class Mail
{
	/*
	list of To addresses
	@var	array
	*/
	var $sendto = array();
	/*
	@var	array
	*/
	var $acc = array();
	/*
	@var	array
	*/
	var $abcc = array();
	/*
	paths of attached files
	@var array
	*/
	var $aattach = array();
	/*
	list of message headers
	@var array
	*/
	var $xheaders = array();
	/*
	message priorities referential
	@var array
	*/
	var $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
	/*
	character set of message
	@var string
	*/
	var $charset = "us-ascii";
	var $ctencoding = "7bit";
	var $receipt = 0;
	

/*

	Mail contructor
	
*/

function Mail()
{
	$this->autoCheck( true );
	$this->boundary= "--" . md5( uniqid("myboundary") );
}


/*		

activate or desactivate the email addresses validator
ex: autoCheck( true ) turn the validator on
by default autoCheck feature is on

@param boolean	$bool set to true to turn on the auto validation
@access public
*/
function autoCheck( $bool )
{
	if( $bool )
		$this->checkAddress = true;
	else
		$this->checkAddress = false;
}


/*

Define the subject line of the email
@param string $subject any monoline string

*/
function Subject( $subject )
{
	$this->xheaders['Subject'] = strtr( $subject, "\r\n" , "  " );
}


/*

set the sender of the mail
@param string $from should be an email address

*/
 
function From( $from )
{

	if( ! is_string($from) ) {
		echo "Class Mail: error, From is not a string";
		exit;
	}
	$this->xheaders['From'] = $from;
}

/*
 set the Reply-to header 
 @param string $email should be an email address

*/ 
function ReplyTo( $address )
{

	if( ! is_string($address) ) 
		return false;
	
	$this->xheaders["Reply-To"] = $address;
		
}


/*
add a receipt to the mail ie.  a confirmation is returned to the "From" address (or "ReplyTo" if defined) 
when the receiver opens the message.

@warning this functionality is *not* a standard, thus only some mail clients are compliants.

*/
 
function Receipt()
{
	$this->receipt = 1;
}


/*
set the mail recipient
@param string $to email address, accept both a single address or an array of addresses

*/

function To( $to )
{

	// TODO : test validité sur to
	if( is_array( $to ) )
		$this->sendto= $to;
	else 
		$this->sendto[] = $to;

	if( $this->checkAddress == true )
		$this->CheckAdresses( $this->sendto );

}


/*		Cc()
 *		set the CC headers ( carbon copy )
 *		$cc : email address(es), accept both array and string
 */

function Cc( $cc )
{
	if( is_array($cc) )
		$this->acc= $cc;
	else 
		$this->acc[]= $cc;
		
	if( $this->checkAddress == true )
		$this->CheckAdresses( $this->acc );
	
}



/*		Bcc()
 *		set the Bcc headers ( blank carbon copy ). 
 *		$bcc : email address(es), accept both array and string
 */

function Bcc( $bcc )
{
	if( is_array($bcc) ) {
		$this->abcc = $bcc;
	} else {
		$this->abcc[]= $bcc;
	}

	if( $this->checkAddress == true )
		$this->CheckAdresses( $this->abcc );
}


/*		Body( text [, charset] )
 *		set the body (message) of the mail
 *		define the charset if the message contains extended characters (accents)
 *		default to us-ascii
 *		$mail->Body( "mél en français avec des accents", "iso-8859-1" );
 */
function Body( $body, $charset="" )
{
	$this->body = $body;
	
	if( $charset != "" ) {
		$this->charset = strtolower($charset);
		if( $this->charset != "us-ascii" )
			$this->ctencoding = "8bit";
	}
}


/*		Organization( $org )
 *		set the Organization header
 */
 
function Organization( $org )
{
	if( trim( $org != "" )  )
		$this->xheaders['Organization'] = $org;
}


/*		Priority( $priority )
 *		set the mail priority 
 *		$priority : integer taken between 1 (highest) and 5 ( lowest )
 *		ex: $mail->Priority(1) ; => Highest
 */
 
function Priority( $priority )
{
	if( ! intval( $priority ) )
		return false;
		
	if( ! isset( $this->priorities[$priority-1]) )
		return false;

	$this->xheaders["X-Priority"] = $this->priorities[$priority-1];
	
	return true;
	
}


/*	
 Attach a file to the mail
 
 @param string $filename : path of the file to attach
 @param string $filetype : MIME-type of the file. default to 'application/x-unknown-content-type'
 @param string $disposition : instruct the Mailclient to display the file if possible ("inline") or always as a link ("attachment") possible values are "inline", "attachment"
 */

function Attach( $filename, $filetype = "application/x-unknown-content-type", $disposition = "inline" )
{
	// TODO : si filetype="", alors chercher dans un tablo de MT connus / extension du fichier
	if( $filetype == "" )
		$filetype = "application/x-unknown-content-type";
		
	$this->aattach[] = $filename;
	$this->actype[] = $filetype;
	$this->adispo[] = $disposition;
}

/*

Build the email message

@access protected

*/
function BuildMail()
{

	// build the headers
	$this->headers = "";
//	$this->xheaders['To'] = implode( ", ", $this->sendto );
	
	if( count($this->acc) > 0 )
		$this->xheaders['CC'] = implode( ", ", $this->acc );
	
	if( count($this->abcc) > 0 ) 
		$this->xheaders['BCC'] = implode( ", ", $this->abcc );
	

	if( $this->receipt ) {
		if( isset($this->xheaders["Reply-To"] ) )
			$this->xheaders["Disposition-Notification-To"] = $this->xheaders["Reply-To"];
		else 
			$this->xheaders["Disposition-Notification-To"] = $this->xheaders['From'];
	}
	
	if( $this->charset != "" ) {
		$this->xheaders["Mime-Version"] = "1.0";
		$this->xheaders["Content-Type"] = "text/plain; charset=$this->charset";
		$this->xheaders["Content-Transfer-Encoding"] = $this->ctencoding;
	}

	$this->xheaders["X-Mailer"] = "Php/libMailv1.3";
	
	// include attached files
	if( count( $this->aattach ) > 0 ) {
		$this->_build_attachement();
	} else {
		$this->fullBody = $this->body;
	}

	reset($this->xheaders);
	while( list( $hdr,$value ) = each( $this->xheaders )  ) {
		if( $hdr != "Subject" )
			$this->headers .= "$hdr: $value\n";
	}
	

}

/*		
	fornat and send the mail
	@access public
	
*/ 
function Send()
{
	$this->BuildMail();
	
	$this->strTo = implode( ", ", $this->sendto );
	
	// envoie du mail
	$res = @mail( $this->strTo, $this->xheaders['Subject'], $this->fullBody, $this->headers );

}



/*
 *		return the whole e-mail , headers + message
 *		can be used for displaying the message in plain text or logging it
 */

function Get()
{
	$this->BuildMail();
	$mail = "To: " . $this->strTo . "\n";
	$mail .= $this->headers . "\n";
	$mail .= $this->fullBody;
	return $mail;
}


/*
	check an email address validity
	@access public
	@param string $address : email address to check
	@return true if email adress is ok
 */
 
function ValidEmail($address)
{
	if( ereg( ".*<(.+)>", $address, $regs ) ) {
		$address = $regs[1];
	}
 	if(ereg( "^[^@  ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$",$address) ) 
 		return true;
 	else
 		return false;
}


/*

	check validity of email addresses 
	@param	array $aad - 
	@return if unvalid, output an error message and exit, this may -should- be customized

 */
 
function CheckAdresses( $aad )
{
	for($i=0;$i< count( $aad); $i++ ) {
		if( ! $this->ValidEmail( $aad[$i]) ) {
			echo "Class Mail, method Mail : invalid address $aad[$i]";	
			exit;
		}
	}
}


/*
 check and encode attach file(s) . internal use only
 @access private
*/

function _build_attachement()
{

	$this->xheaders["Content-Type"] = "multipart/mixed;\n boundary=\"$this->boundary\"";

	$this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\n";
	$this->fullBody .= "Content-Type: text/plain; charset=$this->charset\nContent-Transfer-Encoding: $this->ctencoding\n\n" . $this->body ."\n";
	
	$sep= chr(13) . chr(10);
	
	$ata= array();
	$k=0;
	
	// for each attached file, do...
	for( $i=0; $i < count( $this->aattach); $i++ ) {
		
		$filename = $this->aattach[$i];
		$basename = basename($filename);
		$ctype = $this->actype[$i];	// content-type
		$disposition = $this->adispo[$i];
		
		if( ! file_exists( $filename) ) {
			echo "Class Mail, method attach : file $filename can't be found"; exit;
		}
		$subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n  filename=\"$basename\"\n";
		$ata[$k++] = $subhdr;
		// non encoded line length
		$linesz= filesize( $filename)+1;
		$fp= fopen( $filename, 'r' );
		$ata[$k++] = chunk_split(base64_encode(fread( $fp, $linesz)));
		fclose($fp);
	}
	$this->fullBody .= implode($sep, $ata);
}


} // class Mail


?>







 Historique

26 mars 2005 13:21:27 :
correction bug
07 mai 2005 09:12:58 :
mise a jour

 Sources de la même categorie

Source avec Zip SCREENMAIL-SOLUTION DE CONTACT POUR WEBMASTERS par bnrj
Source avec Zip FORMULAIRE EMAIL AVEC PIECE JOINTE REPRIS DE LITTLEBUBU par cfndiaye
Source avec Zip Source avec une capture MESSAGERIE INTERNE AVEC FICHIER TEXTE par polly19
Source avec Zip FORMULAIRE EVOIE ET PLUS par florentinul
FILTRE POUR NEWSLETTERS GMAIL par durealex

Commentaires et avis

Commentaire de la_pin le 24/03/2005 12:29:24

ce code existe déja sur ce site.
Avant de poster une source, c'est mieux de regarder si elle n'existe pas déjà sur ce site !

Commentaire de mouajria le 25/03/2005 08:17:33

bonjour lapin
c'est vrai que tu a dis , mais comme j'ai deja dis dans l'introduction . le code existant dans le forum n'est pas fonctionnel sous online .

merci

Commentaire de barok le 25/03/2005 11:20:43

question : fichier mail.php, elle vient d'où la variable userfile à la ligne :
if (is_uploaded_file($HTTP_POST_FILES['userfile'])) {

Commentaire de christobal le 28/03/2005 13:15:39

J'avoue que ce script me sera très utile cependant je viens de le tester et j'ai un message d'erreur que je n'arrive pas à corriger.

monfichier.txt Tentative d'attaque possible : ''.
Warning: unlink(monfichier.txt): No such file or directory in mail.php on line 38
le mail a été envoyé

Le contenu des input arrive bien dans ma boîte mais pas la pièce jointe.
De plus les lettres accentuées sont remplacées par des i.

Ci l'on pouvait m'aider, ce sera sympa.
Merci

Commentaire de barok le 28/03/2005 14:19:21

je post le code modifié (par mes soins) demain vers 12h30. Il marche tres bien meme avec des caractere spéciaux et l'envoit de fichier fonctionne. Mais c'est vrai qu'il a fallu repasser derriere

Commentaire de barok le 29/03/2005 13:08:05

Voici le code modifier par mes soins.
Ce n'est pas forcément judicieux mais l'envoie de fichier marche tres bien. Je n'ai modifié que le fichier mail.php le voici

<?php
    include "libmail.php";

$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$societe = $_POST['societe'];
$mail = $_POST['mail'];
$tel = $_POST['tel'];
$fax = $_POST['fax'];
$message = $_POST['message'];
$fileattach = $_POST['fileattach'];
$sujet=$_POST['sujet'];
$msg="nom : $nom \n prénom : $prenom \n société : $societe \n mail : $mail \n tel : $tel \n fax : $fax \n message : \n $message";

$m = new mail(); // create the mail
$m->From($mail);
$m->To("maxime@itachatpro.com");
$m->Subject($sujet);
$m->Body($msg);
//$m->Cc("contact@ascii-web.com");
$m->Priority(4);
//$HTTP_FILES_VARS[
$patharray = explode ("\\", $fileattach);
$FileName=$patharray[count($patharray)-1];

if ("$FileName"!="") {
if (copy($fileattach,   "upload/$FileName")) {
$m->Attach("upload/$FileName");
} else {
echo "Le fichier joint n'a pu être envoyé";
}
}
$m->Send();
if ("$FileName"!="") {
unlink("upload/$FileName");  
}
echo "le mail a éte envoyé ";
}
?>

Commentaire de zouzoux27 le 29/03/2005 15:19:50

merci pour cette aide

Commentaire de zouzoux27 le 29/03/2005 16:52:14

si quelqu'un avit quelque chose à proposer j'ai bien écris le message a été envoyé mais je ne recois rien dans la boite que j'ai spécifié dans $m->To.
Si quelqu'un peut m'aider

Commentaire de christobal le 29/03/2005 20:07:02

Hello, les modifs apportées ne font rien de plus j'ai de nouvelles erreurs :

Warning: copy(C:\\Documents and Settings\\Christobal\\Bureau\\monfichier.doc): failed to open stream: No such file or directory in mail.php on line 28
Le fichier joint n'a pu être envoyé
Warning: unlink(upload/C:\\Documents and Settings\\Christobal\\Bureau\\monfichier.doc): No such file or directory in mail.php on line 36
le mail a éte envoyé

Donc le mail est envoyé mais pas la PJ.
Je ne trouve pas le PB peut tu mette en téléchargement un zip de tes fichiers que tu utilise.
Tu disait que ca fonctionne chez toi.

Merci

Commentaire de zouzoux27 le 30/03/2005 09:45:07

quand je n'envoie pas de fichier joint c'est écrit: le mail a été envoyé. alors que je ne reçois rien dans la boite mail spécifié dans mail.php.
Par contre quand je met une pièce jointe j'ai un message d'erreur qui est:
monfichier.txtClass Mail method attach: file ../upload/monfichier.txt can't be found.

Si il y a une solution. Merci de me la communiquer.

Commentaire de barok le 30/03/2005 13:06:52

regardez cette ligne :
if (copy($fileattach,   "upload/$FileName"))

le repertoire où est copier le fichier est "upload" qui est dans le meme repertoire que mail.php

Si vous voulez que ca marche, il faut creer le repertoire upload

Commentaire de zouzoux27 le 30/03/2005 15:15:39

j'ai déjà le répertoire upload et ca ne marche pas quand même.
Si j'enlève exit; après l'erreur que j'avais tout à l'heure. J'ai encore plus d'erreurs.
qui sont:
monfichier.txt Class Mail, method attach: file ../upload/monfichier.txt can't be found
Warning: filesize():Stat failed for ../upload/monfichier.txt(errno = 2-No such file or directory) in libmail.php line 245
Warning:fopen(../upload/monfichier.txt): failed to open stream: No such file or directory in libmail.php line 246
Warning: fread(): supplied argument is not a valid stream ressource in libmail.php line 247
warning: fclose(): supplied argument is not a valid stream ressource in libmail.php line 248
Warning: unlink(../upload/monfichier.txt): No such file or directory in mail.php line 37
le mail a été envoyé.

Je ne recois rien du tout dans la boite que je spécifie.
Si quelqu'un a une solution.
Merci d'avance.

Commentaire de barok le 30/03/2005 20:26:08

demain soir vous aurez un zip de mes fichiers avec lequel le formulaire fonctionne.

Commentaire de christobal le 01/04/2005 18:52:29

Quand mettrez vous le fichier zip en ligne ?

Commentaire de barok le 02/04/2005 11:34:47

voici le fichier rar :

http://graphismebarok.free.fr/mail/test_mail.rar

ca marche tres bien chez moi. Je  l'ai un peu améliorer c'est a dire qu'il vérifie si certain champs sont bien remplit (nom, prenom etc...) et la cohérence du remplissage (pas de lettre pour un n° de tel par exemple).

Voila dites-moi si ca marche maintenant.

Commentaire de christobal le 02/04/2005 12:06:16

Cela ne change rien L'as tu vraiement essayer avec online.net ?
j'ai tj les mêmes messages d'erreur :

Warning: copy(C:\\Documents and Settings\\Christophe\\Bureau\\Nouveau.txt): failed to open stream: No such file or directory in mail.php on line 95
Le fichier joint n'a pu être envoyé
Warning: unlink(upload/Nouveau.txt): No such file or directory in mail.php on line 106
le mail a éte envoyé

De plus les lettres accentuer sont remplacer par un i.

Ce script me serait vraiment trés utile donc si qq a la soluce, merci de la faire partagé.

Commentaire de Skaaar le 07/04/2005 00:19:25

Pour ton problème de "i", je pense qu'il faudrait regarder du côté de la variable $charset et de $ctencoding : ça ressemble assez à une erreur d'encodage des caractères ;)

Commentaire de sanjb le 15/05/2005 14:03:58

Salut, j'ai un tit pbm avec ce script. je suis sur FREE et a chaque fois que j'essaye d'aller sur la page ou j'ai mit le script j'ai ces messaqges d'erreur. vous savez comment les resoudre?
Warning: session_start(): open(/var/www/free.fr/8/5/sanjb/sessions/sess_bfb8251f9584aa788bf849e4002adbef, O_RDWR) failed: No such file or directory (2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/free.fr/8/5/sanjb/mail/form.php:2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/free.fr/8/5/sanjb/mail/form.php:2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

<<<<<<<<ici j'ai le formulaire a remplir>>>>>>>>>>>>

Warning: Unknown(): open(/var/www/free.fr/8/5/sanjb/sessions/sess_bfb8251f9584aa788bf849e4002adbef, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/free.fr/8/5/sanjb/sessions) in Unknown on line 0

merci

Commentaire de sanjb le 15/05/2005 14:04:51

Salut, j'ai un tit pbm avec ce script. je suis sur FREE et a chaque fois que j'essaye d'aller sur la page ou j'ai mit le script j'ai ces messaqges d'erreur. vous savez comment les resoudre?
Warning: session_start(): open(/var/www/free.fr/8/5/sanjb/sessions/sess_bfb8251f9584aa788bf849e4002adbef, O_RDWR) failed: No such file or directory (2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/free.fr/8/5/sanjb/mail/form.php:2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/free.fr/8/5/sanjb/mail/form.php:2) in /var/www/free.fr/8/5/sanjb/mail/form.php on line 2

<<<<<<<<ici j'ai le formulaire a remplir>>>>>>>>>>>>

Warning: Unknown(): open(/var/www/free.fr/8/5/sanjb/sessions/sess_bfb8251f9584aa788bf849e4002adbef, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/www/free.fr/8/5/sanjb/sessions) in Unknown on line 0

merci

Commentaire de libesse le 11/07/2005 15:08:16

salut je suis vraiment content de faire parti du groupe apen source,etant donne que je suis un debutant jaimerais que si vous donnez une source que vous detaillez la façon dont on lutilise pas à pas .c'est à dire,dire à chaque fichier sa place.merci de votre comprehension

Commentaire de libesse le 11/07/2005 15:12:18

aussi je suis tres dispose a partager les connaissances sur msn ,mon compte est gueleware@hotmail.com

Commentaire de supermos756 le 11/07/2005 19:26:11

putain tu vraiment dingue, j passé 30min pr copié coler et suprimmer les # et en fin ça marche po!
:-(, mdrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

Commentaire de cbenisti le 30/09/2005 16:14:41

en ce qui me concerne je reçois bien les données des champs de texte mais pas la pièce jointe!
pouvez vous m'aider?

Commentaire de lnicos le 04/10/2005 10:16:22

je suis dsl de faire le boulet, mais j'ai le problème que cbenisti...
Est-ce que quelqu'un a trouvé une solution ?

Commentaire de abdelw3 le 26/10/2005 17:36:59

salu vous tous ca va bien j'espere!
j'ai essayé même aprés etre corrigé mais ca ne marche pas l'attachement du fichier et voici l'erreur :
Notice: Undefined index: fileattach in c:\program files\easyphp1-8\www\mail3\mail.php on line 27

Notice: Undefined index: fileattach in c:\program files\easyphp1-8\www\mail3\mail.php on line 31
Tentative d'attaque possible : ''.
Warning: unlink(../upload/chiffre.jpg): No such file or directory in ....................ligne 38

Commentaire de zizou33 le 07/12/2005 11:13:15

Bonjour
Vous disez que ce script fonctionne.Mais moi je pense pas votre script n'envoie pas le mail. j'ai modifier php.in de cette façon:
SMTP = smtp.mail.yahoo.fr;
smtp_port = 25
sendmail_from= k_zied33@yahoo.com;
Bon je ne sais pas ou est le probleme dans ma configuration SMTP ou dans votre script.
Si vous pouvez dés que vous lisez ce msg me repondre sur mon mail k_zied33@yahoo.com ou k.zied2@voila.fr .
S'il voous plais j'ai besoin de se enre de scripte.Aidez moi.
Merci.


Commentaire de Dexmon le 02/01/2008 22:17:42

Ce script ne marche pas et ne marchera jamais

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,406 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales