开发者

Date not in mail

I have the following script to send email using SMTP authentication. Everything works fine but date is not shown in my inbox for this mail. It is marked as '?'. Can anybody help me?

 require_once "Mail.php";

 $from = "test@example";
 $to = $mailto;
 $subject = $subject;
 $body = $msg;

 $host = "test.com";
 $username = "uname";
 $password = "password";

 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject,
    'Content-type'=>'text/html');
 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'auth' => true,
     'username' => $username,
     'password' => $password));

 $ma开发者_如何学编程il = $smtp->send($to, $headers, $body);

 if (PEAR::isError($mail)) {
   //echo("<p>" . $mail->getMessage() . "</p>");
     return false;
  } else {
   //echo("<p>Message successfully sent!</p>");
     return true;
  }

The from,host,username and password values shown here are only test values for security.

Is it any problem with mail headers?


solved it? this worked for me, i just added in the headers array:

'Date'      => date('r', time()),
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜