发送邮件php

时间:2010-03-13 15:23:44

标签: php email

嘿,不知道为什么这个sint工作,但是消息被发送为“0”。我认为电子邮件fIELD是导致它的原因

    <?php
if ($_POST['check'] == 'checked'){
        header("location: /nospamplease.html");
        exit();
}

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$date = $_POST['date'];
$children = $_POST['children'];
$hot = $_POST['hot'];
$comments = $_POST['comments'];

/*echo $name;
echo $email;
echo $phone;
echo $date;
echo $children;
echo $hot;
echo $comments;*/

if($name == "" || $email == "" || $phone == "" || $date == "" || $children == "" || $hot == "" || $comments == ""){
    echo "Please ensure all fields were filled out!";
    exit();
}else{
    $to = "######";
    $subject = "Birthday enquiry";
    $message = "Name: ".$name;
    $message += "Email: ".$email;
    $message += "Phone: ".$phone;
    $message += "Date: ".$date;
    $message += "Children: ".$children;
    $message += "Hot or cold: ".$hot;
    $message += "Comments: ".$comments;
    //echo $message;
    if(mail($to, $subject, $message)){
        echo "Thank you for your enquiry, we will contact you within the next 24 hours! <br /> Click <a href='###'> here</a> to go back to the website!";
    }else{
        echo "There was an error, contact us directly: <a href='mailto:##'>email</a>";
    }
}
?>

我回应了这些变量,它们都得到了很好的发布

谢谢你们

1 个答案:

答案 0 :(得分:4)

您无法使用+在PHP中连接字符串。使用.

$message .= "Email: ".$email;