PHPMailer error loading page
<!DOCTYPE html>
<head>
<title>Form submission</title>
</head>
<body>
<?php
require("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "mygmail@gmail.com"; // SMTP username
$mail->Password = "MY_PASSWORD_GOES_HERE"; // SMTP password
$webmaster_email = "username@doamin.com"; //Reply to this email ID
$email="some1@mail.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->Subject = "This is the subject";
$mail->Body = "Hi"
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
else{
echo "Message has been sent";
}
?>
This is my php script to send an email. It is pretty straightforward and
taken from the PHPMailer homepage. I am trying to serve this from an
Apache server that serves my webpage. When I try to access the script I
get the error: failed to load page.
Is there anything wrong with the php code here? I have modified my php.ini
file also, so everything seems to be like it has to, but it does not work.
No comments:
Post a Comment