我已经制作了一个离线页面,应该允许用户提交他们的电子邮件地址并将其邮寄给我这里是代码
<form action="/templates/jp-revo/send_contact.php" method="post">
<fieldset class="input">
<div id="form-login-username">
<input name="email" id="customer_mail" type="text" class="inputbox" size="18" />
<input type="submit" name="Submit" class="button login" value="Okay" />
</div>
</fieldset>
</form>
这里是send_contact.php
<?php
// Contact subject
$subject ="test";
// Details
$message="hello";
// Mail of sender
$mail_from="$customer_mail";
$header="To : Ben <$mail_from>";
// Enter your email address
$to ='ben@imne.co.uk';
$send_contact=mail($to,$subject,$message,$header);
// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>
我出错的任何想法?
当您提交时,请转到此页面http://smoothprint.co.uk/templates/jp-revo/send_contact.php
答案 0 :(得分:1)
- 你使用joomla? 如果是,最好使用joomla函数发送电子邮件,请参阅this link
- 您的服务器配置是否可以发送电子邮件?
- 将$header="To : Ben <$mail_from>";
更改为$header="FROM: Ben <$mail_from>";
- 在代码$mail_from="$customer_mail";
中,您应首先从帖子中获取$ customer_mail:
$customer_mail = $_POST['email'];
//or joomla way:
$customer_mail = JRequest::getvar('email')