on localhost I use apache and the code works fine and sends email.
on the live site the client uses IIS and the code doesn't works.
Code: Select all
ini_set("display_warnings","1");
ini_set("display_errors","1");
include "Mail.php";
echo 'trying to send email....<br><br>';
$from = "from@domain.com";
$to = "to@domain.com";
$subject = "Hi!";
$body = "This is a test message !";
$host = "mail.domain.com";
$username = "username";
$password = "password";
$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)) {
echo 'Error';
}
else {
echo 'Success';
}
Thanks,