-2

我的联系页面有一些问题。以下是部分:

<form method="post" action="mail.php">
      <input name="nome" type="text" style="width: 265px;" placeholder="Nome e Cognome">
      <input name="mail" type="email" style="width: 263px;" placeholder="E-mail">
      <textarea name="messaggio" placeholder="Messaggio"></textarea>
      <button type="submit" name="invia" style="margin-left: 0; margin-top: 10px;">Invia</button>
    </form>

和..

<?php 


$to = "mail"; 


$subject = "Modulo proveniente dal sito www.miosito.it"; 


$body = "Contenuto del modulo:\n\n"; 
$body .= "Nome: " . trim(stripslashes($_POST["nome"])) . "\n"; 
$body .= "Email: " . trim(stripslashes($_POST["mail"])) . "\n"; 
$body .= "Messaggio: " . trim(stripslashes($_POST["messaggio"])) . "\n"; 



$headers = "From: Valle srl <info@vallesrl.com>";
"Content-Type: text/html; charset=iso-8859-1\n"; 



if(@mail($to, $subject, $body, $headers)) { 
header("Location: http://www.alessandrogiordano.me/test/valle02/sent.php");

} else {

header("Location: http://www.alessandrogiordano.me/test/valle02/nosent.php");

} 

?>

首先..如果我点击提交按钮,所有空白的电子邮件都发送空白。即使我犯了一些错误并且我收到了电子邮件发送的 else 消息.. 显然是空白的。我快疯了。我正在为朋友免费制作这个网站,但我是平面设计师而不是网络开发人员。再也不!:D

帮助!!非常感谢。

4

4 回答 4

1

将此行放在您的标题中

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
于 2013-05-08T10:04:03.133 回答
0

这个

$headers = "From: Valle srl <info@vallesrl.com>";  
"Content-Type: text/html; charset=iso-8859-1\n"; 

应该,

$headers = "From: Valle srl <info@vallesrl.com>";  
$headers. = "Content-Type: text/html; charset=iso-8859-1\n"; 
于 2013-05-08T10:01:23.417 回答
0

在发送邮件之前,您必须验证所有字段是否为空

像这样

if( trim($_POST["nome"]) != "" )
 {
   // send mail

   $isMailSend =   mail($to, $subject, $body, $headers);
 }
 {
   //show error
 }

 if( $isMailSend ) { 
   header("Location: http://www.alessandrogiordano.me/test/valle02/sent.php");

  } else {

  header("Location: http://www.alessandrogiordano.me/test/valle02/nosent.php");

  } 
于 2013-05-08T10:06:28.253 回答
-1

you can't use type="email",there should be type="text"

于 2013-05-08T10:00:26.247 回答