我正在托管我的网站godaddy运行Windows和PHP 5.4并且我的联系表单没有发送。这是保存在htdocs / php中的PHPcode。我已尝试多次尝试进行更改以使其正常工作。
<?php
/*
|--------------------------------------------------------------------------
| Mailer module
|--------------------------------------------------------------------------
|
| These module are used when sending email from contact form
|
*/
/*SECTION I - CONFIGURATION*/
//$receiver_mail = 'youremail@example.com';
$receiver_mail = 'youremail@example.com';
$mail_title = '[Contact Form Submission]';
/*SECTION II - CODE*/
print_r($_POST)
if( !empty($_POST['input-name']) && !empty($_POST['input-mail']) && !empty($_POST['input-message']) )
{
$subject = $mail_title.' message from '.$_POST['input-name'];
$header = 'From: '.$_POST['input-mail'].'\r\nReply-To: '.$_POST['input-mail'];
if ( mail($receiver_mail, $subject, htmlentities($_POST['input-message']), 'From: contactform@thebigbeatsinc.com') )
$result = "Your message was successfully sent.";
else
$result = "Operation could not be completed.";
}
else
{
$result = "Error processing your request.";
}
//echo $result;
echo "Your message was successfully sent.";
?>
HTML:
<form class="contactForm" action="php/contact.php" method="post" target="_blank">
<div class="contactFormTitle font1">
don't be shy, come along & say hi
</div>
<fieldset class="contactFormDetails">
<input type="text" name="input-name" value="" placeholder="Name" />
<input type="text" name="input-mail" value="" placeholder="Subject" />
</fieldset>
<fieldset class="contactFormMessage">
<textarea rows="" cols="" name="input-message" placeholder="Type your message here"></textarea>
</fieldset>
<fieldset class="contactFormButtons">
<input type="submit" value="Send" />
</fieldset>
</form>
答案 0 :(得分:1)
您需要添加方法属性:
<form class="contactForm" action="php/contact.php" method="post">
您还应该进行故障排除和更多关注细节的过程,否则您将花费大量时间在论坛上,试图找出您的代码无效的原因。
答案 1 :(得分:0)
使用GoDaddy,from参数需要是您域名下的电子邮件
if ( mail($receiver_mail, $subject, htmlentities($_POST['input-message']), 'From: contactform@thebigbeatsinc.com') )
$result = "Your message was successfully sent.";
else
$result = "Operation could not be completed.";
你还应该按照Evade Captcha的规定将方法帖子添加到你的形式应答中