I am trying to create a contact form using PHP mailer.. it shows no error but I do not receive the email. I also tried to use the mail() function but it also not working..
Here's my PHP code
<?php
if (!empty($_POST['email']) && !empty($_POST['message'])){
$errors = array();
$to = "kim@t-i-c.asia";
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$body = $_POST['message'];
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= "From:".$email;
require_once 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
// Set UP SMTP
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure ='ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Encoding = '7bit';
//Authentication
$mail->Username = "kuyakimpoy010@gmail.com";
$mail->Password = "password";
// Compose
$mail->SetFrom ("client@t-i-c.asia", $email);
$mail->AddReplyTo("client@t-i-c.asia", $email);
$mail->Subject = $subject;
$mail->MsgHtml($body);
$mail->addAddress($to,'Kim Carlo'); //recipient
$mail->Send();
if($mail){
$errors = "<font style='font-size:18px; color:#000000; line-height:150%'>Thank you!<br><br></font><font style='font-size:16px;''>We have received you message.<br>Your opinions and comments are very important to us and we read every message that we receive.<br>Our goal is to improve our service in any way we can, and we appreciate your taking the time to fill<br>
out our feedback form.<br><br></font>";
}else{
$errors = "<font style='font-size:18px; color:#000000; line-height:150%'>There was a problem sending your message.<br><br>Please try again later.</font>";
}
header("refresh:10; url=/../contactform.php");
}else{
$errors = "<font style='font-size:18px; color:#000000; line- height:150%'>Please fill in email address and message fields<br><br></font>";
}
?>
here is my contact form
<form name="contact" method="POST" action="php/feedback.php">
<label>Name:</label><br>
<input type="text" name="name"/><br><br>
<label>Email Address:<font color="red">*</font></label><br>
<input type="email" name="email"/><br><br>
<label>Subject:</label><br>
<input type="text" name="subject"/><br><br>
<label>Message:<font color="red">*</font></label><br>
<textarea cols="45" rows="10" name="message"></textarea><br><br>
<input type="submit" value="Send Message">