3
respostas

Erro com PHPMailer

Erro este aqui Parse error: syntax error, unexpected 'require_once' (T_REQUIRE_ONCE) in C:\xampp\htdocs\envioemail\enviar.php on line 6

Meu código

<?php 

 $nome = $_POST["nome"];
 $email = $POST["email"]

 require_once("PHPMailerAutoload.php");

 $mail = new PHPMailer(); 
 $mail-> isSMTP(); 
 $mail-> Host = 'smtp.gmail.com';
 $mail-> Port = 587;
 $mail-> SMTPSecure = 'tls'
 $mail-> SMTPAuth = true;
 $mail-> Username = ""
 $mail-> Password = ""

 $mail-> setFrom("ferreiracruz894@gmail.com");
 $addAddress->("");
 $mail-> Subject = "Meu Email";
 $mail-> msgHTML("<html>de: {$nome}<br>email: {$email}<br></html>");

 if($mail->send()) {
    $SESSION["success"] = ""
 }else {
   $mail-> ErrorInfo;
 }
3 respostas

ta faltando o ; ali no final ,$email = $POST["email"] AQUI

Ficaria assim

$nome = $_POST["nome"];
 $email = $POST["email"];

require_once("PHPMailerAutoload.php");

Parse error: syntax error, unexpected '$mail' (T_VARIABLE) in C:\xampp\htdocs\envioemail\enviar.php on line 13

Ainda falta o ; e algumas linhas, creio q seja esse o problema, bons estudos.

$mail = new PHPMailer();
$mail-> isSMTP();
$mail-> Host = 'smtp.gmail.com';
$mail-> Port = 587; 
$mail-> SMTPSecure = 'tls' AQUI
$mail-> SMTPAuth = true;
$mail-> Username = "" AQUI
$mail-> Password = "" AQUI