par
ed_013 » 07 août 2008, 16:06
j'ai donc modifier mon fichier php.ini avec les elements suivants :
Mais l'erreur est toujours la meme
Pleins de question cons maintenant :
- le fichier php.ini est bien le suivant : C:\Program Files\EasyPHP1-8\php\php.ini ?
il y'a 2 autres fichiers (php.ini-dist et php.ini-recommended) dois je les modifiers aussi ?
Edit :
J'ai modifier ma fonction d'envoi de mail en rajoutant :
ini_set("SMTP","smtp.wanadoo.fr");
la ou l'erreur pointait, ca me supprime warning (bon debut) mais je recois pas la mail
Voila le fichier mime_mail.class.php
Code : Tout sélectionner
<?
class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
function mime_mail()
{
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}
function attach($message,$name,$ctype = '')
{
if(empty($ctype)){
switch(strrchr(basename($name), ".")){
case ".gz": $ctype = "application/x-gzip"; break;
case ".tgz": $ctype = "application/x-gzip"; break;
case ".zip": $ctype = "application/zip"; break;
case ".pdf": $ctype = "application/pdf"; break;
case ".png": $ctype = "image/png"; break;
case ".gif": $ctype = "image/gif"; break;
case ".jpg": $ctype = "image/jpeg"; break;
case ".txt": $ctype = "text/plain"; break;
case ".htm": $ctype = "text/html"; break;
case ".html": $ctype = "text/html"; break;
default: $ctype = "application/octet-stream"; break;
}
}
$this->parts[] =
array (
"ctype" => $ctype,
"message" => $message,
"encode" => @$encode,
"name" => $name
);
}
function build_message($part)
{
$message = $part[ "message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
return "Content-Type: ".$part[ "ctype"].
($part[ "name"]? "; name = \"".$part[ "name"]. "\"" : "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}
function build_multipart()
{
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";
for($i = sizeof($this->parts) - 1; $i >= 0; $i--)
{
$multipart .= "\n".$this->build_message($this->parts[$i]). "--$boundary";
}
return $multipart.= "--\n";
}
function send()
{
$mime = "";
if (!empty($this->from)) $mime .= "From: ".$this->from. "\n";
if (!empty($this->headers)) $mime .= $this->headers. "\n";
if (!empty($this->body)) $this->attach($this->body, "", "text/plain");
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();
ini_set("SMTP","smtp.wanadoo.fr");
mail($this->to, $this->subject, "", $mime);
}
};
?>
j'ai donc modifier mon fichier php.ini avec les elements suivants :
[code]
[mail function]
; For Win32 only.
;SMTP = localhost
SMTP = smtp.wanadoo.fr
smtp_port = 25
; For Win32 only.
sendmail_from =
[email protected][/code]
Mais l'erreur est toujours la meme :cry:
Pleins de question cons maintenant :
- le fichier php.ini est bien le suivant : C:\Program Files\EasyPHP1-8\php\php.ini ?
il y'a 2 autres fichiers (php.ini-dist et php.ini-recommended) dois je les modifiers aussi ?
Edit :
J'ai modifier ma fonction d'envoi de mail en rajoutant :
ini_set("SMTP","smtp.wanadoo.fr");
la ou l'erreur pointait, ca me supprime warning (bon debut) mais je recois pas la mail
Voila le fichier mime_mail.class.php
[code]
<?
class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
function mime_mail()
{
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}
function attach($message,$name,$ctype = '')
{
if(empty($ctype)){
switch(strrchr(basename($name), ".")){
case ".gz": $ctype = "application/x-gzip"; break;
case ".tgz": $ctype = "application/x-gzip"; break;
case ".zip": $ctype = "application/zip"; break;
case ".pdf": $ctype = "application/pdf"; break;
case ".png": $ctype = "image/png"; break;
case ".gif": $ctype = "image/gif"; break;
case ".jpg": $ctype = "image/jpeg"; break;
case ".txt": $ctype = "text/plain"; break;
case ".htm": $ctype = "text/html"; break;
case ".html": $ctype = "text/html"; break;
default: $ctype = "application/octet-stream"; break;
}
}
$this->parts[] =
array (
"ctype" => $ctype,
"message" => $message,
"encode" => @$encode,
"name" => $name
);
}
function build_message($part)
{
$message = $part[ "message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
return "Content-Type: ".$part[ "ctype"].
($part[ "name"]? "; name = \"".$part[ "name"]. "\"" : "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";
}
function build_multipart()
{
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary";
for($i = sizeof($this->parts) - 1; $i >= 0; $i--)
{
$multipart .= "\n".$this->build_message($this->parts[$i]). "--$boundary";
}
return $multipart.= "--\n";
}
function send()
{
$mime = "";
if (!empty($this->from)) $mime .= "From: ".$this->from. "\n";
if (!empty($this->headers)) $mime .= $this->headers. "\n";
if (!empty($this->body)) $this->attach($this->body, "", "text/plain");
$mime .= "MIME-Version: 1.0\n".$this->build_multipart();
ini_set("SMTP","smtp.wanadoo.fr");
mail($this->to, $this->subject, "", $mime);
}
};
?>
[/code]