send-contact.php
<?php
session_start();
$nome = $_POST["nome-contato"];
$email = $_POST["email-contato"];
$mensagem = $_POST["mensagem-contato"];
require_once("mailer/mail-autoloader.php");
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "Necro145";
$mail->setFrom("[email protected]", "Murilo Henrique");
$mail->addAddress("[email protected]");
$mail->Subject("Email de contato da Nargloth Store");
$mail->msgHTML("<html> de: {$email} <br/> nome: {$nome} <br/><br/> {$mensagem}</html>");
$mail->AltBody = "de: {$email}\nnome: {$nome}\n\n{$mensagem}";
if ($mail->send()) {
$_SESSION["success"] = "E-mail enviado com sucesso";
header("Location: index.php");
}else{
$_SESSION["error"] = "Devido a um erro, o seu email não foi enviado" . $mail->ErrorInfo;
header("Location: contato.php");
}
die();
Error Log
( ! ) Fatal error: Call to undefined method PHPMailer::Subject() in C:\wamp64\www\phpI\envia-contato.php on line 20
Call Stack
# Time Memory Function Location
1 0.0000 249064 {main}( ) ...\envia-contato.php:0
I'm trying to send a test form with the PHP mailer through localhost, however the above error is occurring.