不能用Firefox和梨发送邮件

时间:2013-10-08 01:52:50

标签: jquery html5 email xmlhttprequest pear

我很困惑所以请耐心等待

我使用pear 1.9.0并且我有这个简单的代码来发送电子邮件。

 <script type='text/javascript'>
function contactsendBack(f){
   //mes is a div to render messages to the user
    document.getElementById("mes").innerHTML="";

   //if the user wants to input some mails to the textfiled, but the textfield is actually empty...
   if(f.elements['pick'].value=="opt"  && f.elements['sendm'].value=="" ){  document.getElementById("mes").innerHTML="Duh, no mails"; return false;}

   //if the user wants to input some mails to the textfiled and also include admin's mail to the list, but the textfield is actually empty...
   else if (f.elements['pick'].value=="admopt"&& f.elements['sendm'].value==""){document.getElementById("mes").innerHTML="Duh, no mails"; return false;}
   else
      {
                  //ok, no errors now, so send to server
             jQuery.post("contactsendBack.php", { 
              name : f.elements['name'].value ,
              mymail : f.elements['mymail'].value ,
              pick : f.elements['pick'].value ,
              sendm : f.elements['sendm'].value ,
              subj : f.elements['subj'].value ,
              comment : f.elements['comment'].value 


              }, function(data) {
             //render what  contactsendBack.php echos...could be "send ok" or "error"
              $('#mes').html(data);
               });   

       return false;

       }
    }

     </script>


//        the html
        <form  action="#"  onSubmit="return contactsendBack(this); return false;" method="post" enctype="multipart/form-data">   
        Name:<br>
        <input name="name" id="name" type="text" required ><br>
        Your e-mail:<br>
        <input name="mymail" id="mymail" type="email"  value="<?php echo $defm ?>" required ><br>

        <input type="radio" id="pick" name="pick" value="adm" checked = "checked">Admin<br>
        <input type="radio" id="pick" name="pick" value="opt">What I set to the textbox<br>
        <input type="radio" id="pick" name="pick" value="admopt">Admin AND What I set to the textbox<br>
        <input type="radio" id="pick" name="pick" value="all">Everyone<br>


        Set some mails:<br>You can input more than one mail. Separate by commas<br>
        <input name="sendm" id="sendm" type="textarea"  rows="24" cols="50"  ><br>

        Subject:<br>
        <input name="subj" id="subj" type="text"  required><br>
        Text :<br>
        <input name="comment" id="comment" type="textarea"  rows="24" cols="50"  required >
         <br>

         <input type="reset"  id="res" name="res"/>
         <input type="submit" id="sub" name="sub"/>
        </form>

这适用于Chrome。 Echos“发送确定”,我可以在我的邮件帐户中看到一封新邮件。但在Firefox和IE回声“发送正常”,我看到我的帐户中没有新邮件。

我也使用j-query 1.8.2

我在IE和FF控制台中看不到任何错误。

我就是不明白。与浏览器有关系?服务器端(contactsendBack.php)?前端?

我该如何解决这个问题?

有什么想法吗?我卡住了

由于

1 个答案:

答案 0 :(得分:0)

检查您发布到脚本的值并比较不同的浏览器版本。可能会有所不同 - 扼杀它。