0
I just downloaded a site I’m working on to a remote server and I just noticed that mail doesn’t reach my gmail inbox. I used a very simple method of code but it doesn’t work, although it says ""Your email was sent successfully! ":
<?php
header('Content-type: text/html; charset=UTF-8');
$name = $_POST['name'];
$email = $_POST['email'];
$carga_type = $_POST['carga_type'];
$weight = $_POST['weight'];
$local = $_POST['local'];
$destiny = $_POST['destiny'];
$date = $_POST['date'];
$company = $_POST['company'];
$tele = $_POST['tele'];
$vol_number = $_POST['vol_number'];
$volume = $_POST['volume'];
$size = $_POST['size'];
$notes = $_POST['notes'];
$to = "[email protected]";
$subject = "Nova messagem";
$message = "De: ".$name."<br>
Email: ".$email."<br>
Tipo de carga: ".$carga_type."<br>
Peso: ".$weight."<br>
Local: ".$local."<br>
Destino: ".$destiny."<br>
Data: ".$date."<br>
empresa: ".$company."<br>
Telefone: ".$tele."<br>
Número de volumes: ".$vol_number."<br>
Volume: ".$volume."<br>
Medidas C x L x A: ".$size."<br>
Notas: ".$notes."<br><br>";
echo ($message);
if (($name == "") || ($carga_type == "") || ($date == "") || ($local == "") || ($tele == "") || ($vol_number==""))
{
echo 'Preencha todos os os campos mínimos necessários (Nome, Tipo de carga, Data, Local e Numero de telefone.)';
}
else
{
mail($to, $subject, $message);
echo "O seu email foi enviado com sucesso! ";
}
?>
you set the
from
? see if return tbmmail()
is false by adding an if.– rray
I don’t think I need to be precise because only these three fields are necessary (to, Subject, message) http://www.w3schools.com/php/php_mail.asp
– Miguel
do the following test, add these 2 lines at the beginning of your page:
ini_set('display_errors', true); error_reporting(E_ALL);
and the mail line for:if(!mail($to, $subject, $message)){
 echo error_get_last();
}
– rray
You have configured the remote SMTP server in PHP ? http://www.php.net/manualen/mail.configuration.php
– gmsantos
@Lost Thanks but there is no error, everything runs normally ("Your email has been sent successfully! ")
– Miguel
How to configure this SMTP server on remote?
– Miguel
@Miguel usually leaves the mailing mechanism on the machine itself. What is the operating system and/or hosting?
– Diego Souza