par
Mohi » 28 janv. 2013, 14:51
Oui c'est le même code que j'utilise. J'ai tout recommencé en reprenant ton article et j'ai exactement la même erreur.
Code :
Code : Tout sélectionner
echo "start </br>";
include_once dirname( __FILE__ ) . '/PHMailer/class.phpmailer.php';
define('GUSER', '[email protected]'); // GMail username
define('GPWD', 'florian666'); // GMail password
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
smtpmailer('[email protected]', '', '[email protected]', 'kelrobot', 'test mail message', 'Hello World!');
if (smtpmailer('[email protected]', '[email protected]', 'kelrobot', 'test mail message', 'Hello World!')) {
// do something
}
if (!empty($error)) echo $error;
echo "</br> end";
Résultat :
Ca peut venir de mon serveur ?
Je suis héberger chez Gandi.
Merci encore.
Oui c'est le même code que j'utilise. J'ai tout recommencé en reprenant ton article et j'ai exactement la même erreur.
Code :
[code] echo "start </br>";
include_once dirname( __FILE__ ) . '/PHMailer/class.phpmailer.php';
define('GUSER', '
[email protected]'); // GMail username
define('GPWD', 'florian666'); // GMail password
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
smtpmailer('
[email protected]', '', '
[email protected]', 'kelrobot', 'test mail message', 'Hello World!');
if (smtpmailer('
[email protected]', '
[email protected]', 'kelrobot', 'test mail message', 'Hello World!')) {
// do something
}
if (!empty($error)) echo $error;
echo "</br> end";[/code]
Résultat :
[code]start
Mail error: The following From address failed:
[email protected]end[/code]
Ca peut venir de mon serveur ?
Je suis héberger chez Gandi.
Merci encore.