I am using phpmailer without SMTP to send email from my website hosted at namecheap. Code is shown below. I am getting the error "Could not instantiate mail function." I have read out many thread here but I am unable to get my issue solved. Need help, Thanks
I have tried using
$mail->From = $email;
$mail->FromName = $name;
instead of $mail->SetFrom($email, $name);
and vice versa.
also with and without $mail->addReplyTo()
function.
<?php
require 'phpmailer/PHPMailerAutoload.php';
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$mail = new PHPMailer();
$mail->SMTPDebug = 1; //for debugging
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$name = $_POST['name'];
$date = $_POST['date'];
$no_of_people = $_POST['NoOfPerson'];
$package = $_POST['select-package'];
$comment = $_POST['comment'];
//$mail->SetFrom($email, $name);
$mail->From = $email;
$mail->FromName = $name;
$mail->addAddress("umarsattar1989@hotmail.com"); //Recipient Email
//$mail->addReplyTo($email, "Reply");
$Message = "Some Text Here";
$mail->Subject = "Inquiry about ".$package." Package";
$mail->Body = $Message;
if(!$mail->send()) {
$result = "Mailer Error: " . $mail->ErrorInfo;
} //if closing
else
{
$result = "Message has been sent successfully";
} //else closing
} //main if closing
"Mailer Error: Could not instantiate mail function." is printing in $result
variable