This is the code:-
- Code: Select all
<?php
$name = $_POST['username'];
$email = $_POST['email'];
$text = $_POST['inquiry'];
//To, Subject, Message, Header
//mail('conn_man7@hotmail.com', 'Basic Inquiry', $text, 'From: ' . $name . ' <' . $email . '>');
//header('Location: thanks.php');
?>
<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$body = $text;
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "mail@macromac.com.my"; // GMAIL username
$mail->Password = "q1w2e3r4t5"; // GMAIL password
$mail->SetFrom($email, $name);
$mail->Subject = "Product Enquiry";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "bill@macromac.com.my";
$mail->AddAddress($address, "Bill");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
and this is the output after receiving email as attached...
is there anyway to fix the mismatch issue? Thanks.
test is the sender's name btw.


