xgnic 发表于 2018-2-11 12:12:50


            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]
查看完整版本: phpʹ��pear_smtp�����ʼ�