2014-01-26 53 views
-1

我有一個sendMail PHP函數,它的工作原理,但只要我嘗試一個更長的消息,它停止工作。任何想法爲什麼發生這種情況?sendMail函數有限字符?

function send_mail($from,$to,$subject,$body) 
{ 
    $headers = ''; 
    $headers .= "From: $from\n"; 
    $headers .= "Reply-to: $from\n"; 
    $headers .= "Return-Path: $from\n"; 
    $headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n"; 
    $headers .= "MIME-Version: 1.0\n"; 
    $headers .= "Date: " . date('r', time()) . "\n"; 

    mail($to,$subject,$body,$headers); 
} 

回答

0

http://pl1.php.net/manual/en/function.mail.php

每一行應該以CRLF(\ r \ n)的分離。行不應該是大於70個字符的 。

請嘗試更改Heders行分隔符。確保身體也格式良好。你會在手冊中找到例子。

祝你好運!