Jump to content
Fórum Script Brasil
  • 0



Olá galera, bom dia.

Estou com um problema no meu sendemail.php, a função mail esta funcionando sem problemas só que minhas variáveis estão retornando vazias, no e-mail chega todo em branco e sem assunto. Vou colocar meu código abaixo:



<form id="main-contact-form" name="contact-form" method="post" action="sendemail.php">
                                <div class="form-group">
                                    <input type="text" name="nome" class="form-control" placeholder="Nome" required>
                                <div class="form-group">
                                    <input type="email" name="email" class="form-control" placeholder="E-mail" required>
                                <div class="form-group">
                                    <input type="text" name="assunto" class="form-control" placeholder="Assunto" required>
                                <div class="form-group">
                                    <textarea name="mensagem" class="form-control" rows="8" placeholder="Mensagem" required></textarea>
                                <button type="submit" class="btn btn-primary">Send Message</button>




$name       = @trim(stripslashes($_POST['nome']));
$from       = @trim(stripslashes($_POST['email']));
$subject    = @trim(stripslashes($_POST['assunto']));
$message    = @trim(stripslashes($_POST['mensagem']));
$to           = 'felipeitalves@gmail.com';

$body = 'Nome: ' . $name . "\n\n" . 'E-mail: ' . $from . "\n\n" . 'Telefone: ' . $subject . "\n\n" . 'Mensagem: ' . $message;

$headers = "MIME-Version: 1.1\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: felipe.alves@outlook.com.br\r\n";
$headers .= "Return-Path: felipe.alves@outlook.com.br\r\n";

@mail($to, $subject, $body, $headers, "-r" . "felipe.alves@outlook.com.br");


Código Ajax:


// Contact form
var form = $('#main-contact-form');
var form_status = $('<div class="form_status"></div>');
url: $(this).attr('action'),
beforeSend: function(){
form.prepend( form_status.html('<p><i class="fa fa-spinner fa-spin"></i> Enviando e-mail</p>').fadeIn() );
form_status.html('<p class="text-success">Obrigado pelo seu contato</p>').delay(3000).fadeOut();



Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...