0
我遇到了無法通過註冊按鈕的問題。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 = "[email protected]";
if (isset($_REQUEST['email']) && $_REQUEST['email'] != '')
{
$email = $_REQUEST['email'];
sendMailSingup($from, $email);
sendMailSingup($from, "[email protected]");
}
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
謝謝!
你不允許運行'/ usr/sbin目錄/ sendmail'。如果您需要'IsSendmail()'而不是'IsMail()',請檢查您允許使用的二進制文件的位置。如果兩者都不起作用並且找不到二進制文件,請與您的包裝箱的系統管理員聯繫。 – Wrikken
您是否安裝並配置了sendmail? – Gavin
有時$ mail-> IsSendmail();可能會導致此錯誤。嘗試評論一下,看看是否有任何事情發生。 – Billy