php使用pear_smtp发送简单邮件
<?php
require_once "vendor/autoload.php";
$from = "test<test@163.com>";
$to = "test <test@outlook.com>";
$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("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
以上就是PHP使用pear_smtp发送简单邮件的内容,更多相关内容请关注PHP中文网(www.php.cn)!
魔众题库系统基于PHP开发,可以用于题库管理和试卷生成软件,拥有极简界面和强大的功能,用户遍及全国各行各业。 魔众题库系统,融合在线题库和在线考试。 魔众题库系统融合了在线题库和在线考试功能,提供了极简界面和强大的功能。它基于PHP开发,采用PHP+Mysql架构,对SEO友好,安全稳定,支持多终端展示,使用起来极其简单。该系统支持模块式搭建,并允许用户进行模板和插件的二次开发,以满足
0
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号