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
| require_once("Mail.php");
$recipients = "adresse1@fai.fr";
$headers["From"] = "adresse1@fai.fr";
$headers["To"] = "adresse2@fai.fr";
$headers["Subject"] = "Test message";
$body = "TEST MESSAGE!!!";
$params["host"] = "smtp.orange.fr";
$params["port"] = "25";
$params["auth"] = false;
//$params["username"] = "";
//$params["password"] = "";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory('smtp', $params);
if (PEAR::isError($mail_object))
{
print "<p>construction de l'objet 'Mail' ratée car ";
die($mail_object->getMessage());
}
else
{
print "<p>objet 'Mail' construit !";
}
$send_result = $mail_object->send($recipients,$headers,$body);
if (PEAR::isError($send_result))
{
print "<p>envoi de l'email raté car ";
die($send_result->getMessage());
}
else
{
print "<p>envoyé !";
} |
Partager