0
require_once "Mail.php";
error_reporting(E_ALL ^ E_STRICT);
    $mail_To = $email;
            $mail_Subject = "Reservation notification From Tamera Plaza Inn";
            $mail_Body = "First Name: $name\n".
    "Last Name: $last\n".
    "Email: $email \n".
    "City: $city \n".
    "Zip Code: $zip \n".
    "Country: $country \n".
    "Contact Number: $cnumber \n".
    "Password: $password \n".
    "Check In: $arrival\n ".
    "Check Out: $departure\n ".
    "Number of Adults: $adults\n ".
    "Number of child: $child\n ".
    "Total nights of stay: $result\n ".
    "Room Type: $type\n ".
    "Number of rooms: $nroom\n ".
    "Payable amount: $payable\n ".
    "Confirmation Number: $confirmation\n ";

     $host = "localhost";
             $username = "";
             $password = "";

 $smtp = Mail::factory('smtp',
        array ('host' => $host,
               'auth' => true,
               'username' => $username,
               'password' => $password));

     $mail = $smtp->send($mail_To, $mail_Subject, $mail_Body);
       if (PEAR::isError($mail)) {
           echo("<p>" . $mail->getMessage() . "</p>");
       } else {
           echo("<p>Message successfully sent!</p>");
       }

As you can see, the code above is used to send emails. That is what my web is trying to do but one thing hinders my success is the error below. I can't seem to connect to my mail server which is PEAR. Am I missing something here?

ERROR:
  Failed to connect to localhost:25 [SMTP: Failed to connect socket: No connection could be made because the target machine actively refused it. (code: -1, response: )]

By the way, I'm using Wampserver

GM-Xile GM-Xile
  • 321
  • 1
  • 8
  • 21

1 Answers1

0
No connection could be made because the target machine actively refused it. 

This is your problem, as stated in your error message. Check the firewall settings of your mail server.

cweiske
  • 30,033
  • 14
  • 133
  • 194