PHP�Դ���mail�����Ƚϵ��ۣ���win��������sendmail�����������ʼ�����ʹ�õ�������pear/mail����ֱ��ͨ��smtp�����ʼ����ͷ���������(smtp.163.com)���Ӷ�û�б�Ҫ�ڱ����ϰ�װsendmail�����������
ȷ��PEAR Mail���Ѿ���װ��
";
$to = "test ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "smtp.163.com";
$port = "25";
$username = "test@163.com";
$password = "test123";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
// 'debug'=>true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("" . $mail->getMessage() . "
");
} else {
echo("Message successfully sent!
");
}
?>
页:
[1]