When I get the value of the email field that the user typed in, the email doesn't arrive. There's not even an error when sending, but I don't receive the e-mail. I can only receive email when I add an email address with the website address, eg 'greenervasul@greenervasul.com.br'.
I've already researched, tried a few things and haven't got anything so far. Does anyone know why?
<?php
$url = $_SERVER['HTTP_REFERER'];
$url = strtok($url, '?');
$name = $_POST['name'];
$tel = $_POST['phone'];
$company = $_POST['company'];
$from = $_POST['email'];
$message = $_POST['message'];
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.kinghost.net'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'nelson@greenervasul.com.br';
$mail->Password = '@@@@@@@@@@';
$mail->SMTPSecure = 'startls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = '587'; // TCP port to connect to
$mail->setFrom($from, $name);
$mail->addAddress('gabrielruiztq@gmail.com');
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Lojista';
$mail->Body = 'Nome: '.$name. '<br>Telefone: '.$tel. '<br>Empresa: '.$company. '<br>Menagem: '.$message;
$mail->AltBody = $message;
if(!$mail->send()) {
header("Location: $url?send=error");
} else {
header("Location: $url?send=success");
}