After struggling with PHPmailer on my website I have yet to reach a solution. First, I was receiving fatal errors from my require() function but changed the path to relative and it worked. Next up, syntax error on line 7. I am not entirely sure why I am receiving an error, can anybody help?
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
require "PHPMailer/PHPMailerAutoload.php"
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "localhost";
$mail->SMTPAuth = true;
$mail->Username = "(myemail)"; // SMTP username
$mail->Password = "(mypassword)"; // SMTP password
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->From = "(myemail)";
$mail->addAddress('anotheroneofmyemails');
// set word wrap to 50 characters
$mail->WordWrap = 50;
// set email format to HTML
$mail->IsHTML(true);
$mail->Subject = 'Customer Inquiry Information:';
$mail->Body = $message;
$mail->AltBody = $message;
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>