Error sending form with PHP

0

I created a script to send an email to my Gmail in PHP, but it is giving me an error while submitting the form, ERROR 405 Not Allowed p>

This is my form:

<form action="email.php" method="post">
  <div class="cols">
    <div class="col">
      <div class="form-group">
        <input name="nome" type="text" placeholder="Nome" required>
      </div>
    </div>
    <div class="col">
      <div class="form-group">
        <input name="email" type="email" placeholder="Email" required>
      </div>
    </div>
    <div class="col">
      <div class="form-group">
        <input name="telefone" type="number" placeholder="Telefone">
      </div>
    </div>
    <div class="col">
      <div class="form-group">
        <select name="opcao">
          <option>Selecione uma opção</option>
          <option>Orçamento</option>
          <option>Duvidas Referente ao Serviço</option>
          <option>Outro</option>
        </select>
      </div>
    </div>
  </div>
  <div class="text-area">
    <textarea name="mensagem" placeholder="Escreva sua mensagem"></textarea>
  </div>

  <div class "form-group">
    <button class="botao medio"><i class="fa fa-envelope" aria-hidden="true"></i> Enviar</button>
  <div>

And this is my email.php script

<?php

$nome       =   $_POST["nome"];
$email      =   $_POST["email"];
$telefone   =   $_POST["telefone"];
$assunto    =   $_POST["opcao"];
$mensagem   =   $_POST["mensagem"];

include("class.phpmailer.php");
include("class.smtp.php");

$mail = new PHPMailer();

$mail->SMTP_PORT = "587";
$mail->SMTPSecure = "tls";

$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;

$mail->Username = '[email protected]';
$mail->Password = 'minhasenha';

$mail->From = $email;
$mail->FromName = $nome;

$mail->AddAddress($email, $nome);
$mail->AddCC('[email protected]', 'Auto-Jet');

$mail->IsHTML(true);  

$mail->Subject = $assunto
$mail->Body = $mensagem;

$enviado = $mail->Send();

if ($enviado) {
    echo "Email Enviado com Sucesso";
}   else { 
    echo "Não foi Posssivel Enviar sua Mensagem";
}

?>
    
asked by anonymous 25.07.2017 / 22:03

0 answers