PHP表单邮件错误

时间:2013-10-23 22:22:55

标签: php

我遇到了无法发送的注册按钮的问题。

这是主页面中的代码(注册按钮所在的位置):

<div class="signup">
                                <form action="sendmail.php" method="post" name="frm-signup" id="frm-signup">
                                    <div id="item-form">
                                    <input class="email"  type="text"  value="Your e-mail address" onclick="value=''" size="20px" name="email" id="jf_email"/>
                                    <input class="submit" type="button" name="submit" value="Sign up" size="95px" id="jf_submit"/>
                                    </div>
                                    <div style="position: relative;">
                                    <div id="jf_error_email" style="display:none;">
                                    <p class="hs_infor">
                                        This isn't a valid email address
                                    </p>
                                    </div>
                                    </div>
                                </form>
                                <p style="display: none;" id="thank_you">Thank you. We'll update you as soon as possible.</p>
                          </div>

基本上意味着当您在输入有效格式的电子邮件地址后点击注册按钮时,下面会显示一条消息(谢谢。我们会更新您等)。目前按钮根本不起作用。它没有将电子邮件发回给他们的电子邮件而没有显示感谢信息。

这是sendmail.php的php代码:

<?php

$from = "ask@michaelfrieda2014.com";
if (isset($_REQUEST['email']) && $_REQUEST['email'] != '')
{
    $email = $_REQUEST['email'];
    sendMailSingup($from, $email);
    sendMailSingup($from, "ask@michaelfrieda2014.com");
}

function sendMailSingup($from, $to)
{
    include_once('phpmailer/class.phpmailer.php');
    $mail             = new PHPMailer();

    $body             = "Thank you. We'll update you as soon as possible.";    
    $mail->IsSendmail(); // telling the class to use SendMail transport    
    $mail->From       = "$from";
    $mail->FromName   = "Frieda and Michael";
    $mail->Subject    = "Thank you!";    
    $mail->AltBody    = "Thank you!"; // optional, comment out and test    
    $mail->MsgHTML($body);    
    $mail->AddAddress("$to", "");
    //$mail->AddAttachment("images/phpmailer.gif");             // attachment
    if(!$mail->Send()) {
      echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
      #echo "Message sent!";
      echo 1;
    }
}

当您输入电子邮件地址时,它们会返回错误:

邮件程序错误:无法执行:/ usr / sbin / sendmailMailer错误:无法执行:/ usr / sbin / sendmail

谢谢!

1 个答案:

答案 0 :(得分:0)

 <input class="submit" type="button" name="submit"

应该是:

<input class="submit" type="submit" name="submit"