douyun1546 2013-11-14 08:03
浏览 8
已采纳

没有从我的网站收到任何邮件......? [关闭]

I am working on simple website but facing some problems with contact form, I try all type of settings but Its didnt work.

The problem is When I fill form and press submit button then It will be shows "Message sent successfully" But I cant receive any mail to my mail ID.

So What Can I do...???

My PHP CODE: file name is "mail.php"

<?php
  echo '<html xmlns="http://www.w3.org/1999/xhtml">';
  echo '<head>';
  echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
  echo '<title>';
  echo $title;
  echo '</title>';
  echo '</head>';
  echo '<body>';  

$to = "anup.karanjkar08@gmail.com;
$subject = $_REQUEST['Name'] + "Sent a Mail";
$message = $_REQUEST['Message'] ;
$from = $_REQUEST['Email'] ;
$headers = "From:" . $from;
$a= mail($to,$subject,$message);
if ($a) {
  echo "Message sent successfully";
}
else
{
  echo "Sorry there is an error.";
}
echo '</body>';
echo '</html>';

?>

My HTML CODE

<form name="contact_to_infrasure" id="infrasure"  action="mail.php" method="POST">
          <div class="row-fluid">
            NAME<br><input  type="text" name="Name">
          </div>
          <div class="row-fluid">
            EMAIL<br><input  type="text" name="Email"><br>
          </div>
          <div class="row-fluid">
            MESSAGE<br><textarea rows="5" style="width: 60%"  name="Message"></textarea><br>
          </div>
          <div class="row-fluid">
           <!--  <input class="span3" type="submit" value="SEND MESSAGE"> -->
          <button class="btn" type="submit" value="Submit" onClick="">SEND MESSAGE</button> 
          </div>
      </form>

Please Help Me...!!!

  • 写回答

2条回答 默认 最新

  • donglizuo8892 2013-11-14 08:08
    关注

    changed these lines, concatination used in php is . not +, + used in javscript $subject = $_REQUEST['Name'] . "Sent a Mail";

            <?php
              echo '<html xmlns="http://www.w3.org/1999/xhtml">';
              echo '<head>';
              echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
              echo '<title>';
              echo $title;
              echo '</title>';
              echo '</head>';
              echo '<body>';  
    
                $to = "anup.karanjkar08@gmail.com";
                $subject = $_REQUEST['Name'] . "Sent a Mail"; // changed this line  removed + 
                $message = $_REQUEST['Message'] ;
                $from = $_REQUEST['Email'] ;
                $headers = "From:" . $from;
                $a= mail($to,$subject,$message, $headers); // added headers here
                if ($a) {
                  echo "Message sent successfully";
                }
                else
                {
                  echo "Sorry there is an error.";
                }
                echo '</body>';
                echo '</html>';
    
            ?>
    

    Reason for mail not sending,

    ISP Blocks

    An increasing number of ISP’s are blocking port 25, the port used to send email. Many of the major ISP’s, including NetZero, MSN, Earthlink, AT&T, Comcast and Verizon, block port 25 in an attempt to control spam. If your ISP blocks port 25, then you will be unable to send email out of your server. This is not a server problem but a direct block by your ISP. We can often work around these blocks by configuring your mail server to listen to additional ports.

    Ref: http://www.rackaid.com/resources/cannot-send-email-how-to-fix-email-sending-and-receiving-errors/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器