PHP发送消息给邮件

时间:2013-01-27 21:43:28

标签: php forms html-table

当我想加入我的php文件并发送消息时,我遇到了问题。

    $to = "xxx@example.com";
    $subject = "You have new message";   
    $first = $_POST["first_name"];
    $second = $_POST["second_name"];
    $phone = $_POST["phnumber"];
    $email = $_POST["email"];
    $message = $_POST["message"];
    $body = "
       First name:<br>
       $first<br>
       ----------------------------------------------
       Last name:<br>
       $second<br>
       ----------------------------------------------
       Phone number:<br>
       $phone<br>
       -----------------------------------------------
       Email:<br>
       $email<br>
       ------------------------------------------------
       Message:<br>
       $message<br>
            ";
    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0; \r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1; \r\n";
    // More headers
    $headers .= "From: $email \r\n";
    $headers .= "Cc: $to; \r\n Subject:$subject \r\n";      
    if (mail($to, $subject, $body, $headers)) {
    echo("<p>Message successfully sent!</p>");......

问题出在哪里?我在服务器上用FileZilla上传文件,但是我无法发送邮件。错误是405

0 个答案:

没有答案