您好我下载了一个带有bootstrap的模板,联系表单会发送电子邮件,但内容为空,我不知道原因。
这是HTML表单
<form id="main-contact-form" class="contact-form" name="contact-form" method="get" action="sendemail.php">
<div class="col-sm-5 col-sm-offset-1">
<div class="form-group">
<label>Nombre *</label>
<input type="text" name="name" id="name" class="form-control" required="required">
</div>
<div class="form-group">
<label>Email *</label>
<input type="email" name="email" id="email" class="form-control" required="required">
</div>
<div class="form-group">
<label>Telefono</label>
<input type="number" name="phone" id="phone" class="form-control">
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label>Titulo *</label>
<input type="text" name="subject" id="subject" class="form-control" required="required">
</div>
<div class="form-group">
<label>Mensaje *</label>
<textarea name="message" id="message" required="required" class="form-control" rows="8"></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Enviar Mensaje</button>
</div>
</div>
</form>
这是sendmail.php
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'<b>Gracias por contactarnos. Nos comunicaremos con usted lo antes posible</b> '
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = 'my@email.com';//replace with your email
$body = 'Nombre: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Tema: ' . $subject . "\n\n" . 'Mensaje: ' . $message;
$success = @mail($email_to, $subject, $body, 'De: <'.$email_from.'>');
echo json_encode($status);
die;
?>
我不知道为什么不工作,请我帮忙解决这个问题
提前致谢