[PEAR][Mail] Utilisation de la classe Mail
Bonjour,
Je viens d'installer PEAR et le package MAIL sur un serveur IIS (win2003).
Lorsque je fais un test je reçois toujours:
Citation:
Test : Ceci est le sujet du message!
1) Ceci est un test.
2) Ceci est un test.
3) Ceci est un test.
Voici le code php (exemple trouvé sur la toile):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| <?
require_once "Mail.php";
/**************************************************
EDIT the following variables for your own use
***************************************************/
$from = "Krapno <krapno@mondomaine.com>";
$to = "Krapno <krapno@mondomaine.com>";
$subject = "SUJET DU MESSAGE";
$host = "mail.mondomaine.com";
$username = "monLogin";
$password = "monPassw";
$body = "CORPS HTML DU MESSAGE";
/**************************************************
***************************************************/
$headers = array (
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory(
'smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password
)
);
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
/**************************************************
ERROR MESSAGE
***************************************************/
echo "<p>";
echo $mail->getMessage();
echo "</p>";
} else {
/**************************************************
SUCCESS MESSAGE
***************************************************/
echo "<p>Message successfully sent!</p>";
}
?> |
Et j'ai aussi l'erreur suivante à l'exécution de ce script:
Citation:
Fatal error: Class 'Mail' not found in D:\ROOT_WWW\(...)\pear_mail__test.php on line 29
Je ne vois pas où est le problème :(
Merci pour vos éventuelles suggestions.
Très cordialement,