0

Good day! I have tried and search everything I can find.. but to no avail, code is still not working, and I'm not even getting any error message. I have no problem with my variables, it is in the "mail" part i think. Please help.

require "Mail.php";
$from = 'angelsofmaryacademy@gmail.com';
$to = $hidden1;
$subject = $hidden2;
$body = $_POST['replytomsg'];

$host = "smtp.gmail.com";
$port = "465";
$user = "angelsofmaryacademy@gmail.com";
$pass = "Ang3lsofmaryacademy";


$headers = array ("From" => $from, "To" => $to, "Subject" => $subject);

$smtp = @Mail::factory("smtp",array(
                       "host" => $host,
                       "port" => $port,
                       "auth" =>true,   
                       "username" => $user,
                       "password" => $pass));


$mail = $smtp->send($to, $headers, $body);


if (PEAR::isError($mail)) {
  echo ('<p>'. $mail->getMessage() . '</p>');
}
else {
   echo ('<p>Message successfully sent! </p>');
} 

}
NoNaMe
  • 5,410
  • 30
  • 73
  • 98
  • 1
    Why have you got the @ before the function? Won't that supress any errors which might may occur? – Script47 Jul 27 '15 at 05:54
  • possible duplicate of [Sending email with PHP from an SMTP server](http://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server) – Abdulla Nilam Jul 27 '15 at 07:14

0 Answers0