Hello! I have the following form:
<form role="form" method="post" action="send_email.php" id="formContato">
<div class="left">
<fieldset class="mail"><input placeholder="Endereço e-mail" type="text" name="email" id="email"></fieldset>
<fieldset class="name"><input placeholder="Primeiro nome" type="text" name="primeiro_nome" id="primeiro_nome"></fieldset>
<fieldset class="name"><input placeholder="Segundo nome" type="text" name="ultimo_nome" id="ultimo_nome"></fieldset>
<fieldset class="name"><input placeholder="Telefone" type="text" name="telefone" id="telefone"></fieldset>
<fieldset class="subject">
<select name="assunto" id="assunto">
aias, <option>Dúvida</option>
<option>Reclamações</option>
<option>Outros</option>
</select>
</fieldset>
</div>
<div class="right">
<fieldset class="question">
<textarea name="mensagem" id="mensagem" placeholder="Digite sua mensagem..."></textarea></fieldset>
</div>
<div class="btn-holder">
<button class="btn blue" type="submit" value="enviar" name="enviar" id="enviar">Enviar</button>
</div>
</form>
and the file send_email.php:
<?php
require 'PHPMailerAutoload.php';
require 'vendor/autoload.php';
require 'PHPMailer';
if(isset($_POST['enviar'])){
// Fetching data that is entered by the user
$email = $_POST['email'];
$primeiro_nome = $_POST['primeiro_nome'];
$ultimo_nome = $_POST['ultimo_nome'];
$mensagem = $_POST['mensagem'];
$assunto = $_POST['assunto'];
$telefone = $_PPOST['telefone'];
$to_id = '[email protected]';
// Configuring SMTP server settings
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = $to_id;
$mail->Password = 'senha';
// Email Sending Details
$mail->addAddress($to_id);
$mail->Subject = $assunto;
$mail->msgHTML($email . "\r\n" .$mensagem);
// Success or Failure
if (!$mail->send()) {
$error = "Mailer Error: " . $mail->ErrorInfo;
echo '<p id="para">'.$error.'</p>';
}
else {
echo '<p id="para">Message sent!</p>';
}
}
else{
echo '<p id="para">Please enter valid data</p>';
}
?>
The problem is that when the form is populated and the fields are submitted via post to the action send_email.php
, nothing happens at this URL.
in the case, the URL would be: localhost/site/index.html
, where the form is filled and then, when submitted, goes to localhost / site / send_email.php (however, this page is blank). As I'm developing this app in the sublime text, I just can not debug the logical part well. (I already tried to implement the xdebug package in sublime but I had difficulties in using it).
I already deleted all this code from send_email.php
, leaving only phpinfo()
to test if php
is working (and it is!).
Funny, even if I $email = $_POST['email'];
soon after <?php
and then start echo $email
, still nothing appears