我刚接触php编码。我试图从一个html页面发送一封电子邮件。它被重定向到我的'email.php',但它没有发送电子邮件。我的代码就在这里..
<?php
//if "email" is filled out, send email
//send email
$name = $_REQUEST['your-name'] ;
$email = $_REQUEST['your-email'] ;
$company= $_REQUEST['company'] ;
$website= $_REQUEST['website'] ;
$message=$name."<br>".$company."<br>".$website."<br>".$email;
$subject = 'Hai there' ;
$message = $_REQUEST['message'] ;
mail("sample@gmail.com", $subject,
$message, "From:" . $email);
if(mail()){
echo 'successfull';
}
else{
echo 'not successfull';
}
?>
它总是显示'不成功'。
答案 0 :(得分:2)
替换
if(mail()){
与
if(mail("sample@gmail.com", $subject, $message, "From:" . $email)){
答案 1 :(得分:0)