phpmailer--我一直在使用的php邮件类,绝对经典!
时间:2006-07-13 来源:xh_terry
文件:
phpmailer.rar
大小:
27KB
下载:
下载
这个是我一直使用的php邮件类,里边有我的一个试用例子,一看就懂,很easy!
解释index.php
//导入类文件
require("class.phpmailer.php");
//声明类
$mail = new PHPMailer();
// 设置使用 SMTP
$mail->IsSMTP();
// 指定的 SMTP 服务器地址
$mail->Host = "61.172.255.101";
// 设置为安全验证方式
$mail->SMTPAuth = true;
// SMTP 发邮件人的用户名
$mail->Username = "
[email protected]
";
// SMTP 密码
$mail->Password = "kaibleservice";
$mail->From = "
[email protected]
";
$mail->FromName = "凯搏网";
$mail->AddAddress("
[email protected]
");
//AddAddress函数格式为("收件地址","收件人")
//$mail->AddAddress("
[[email protected]","dalilng][email protected]","dalilng[/email]
");
//$mail->AddAddress("
[[email protected]","daling][email protected]","daling[/email]
"); // 可选
//可以回复的地址
//$mail->AddReplyTo("
[email protected]
", "TERRY2");
// 50字折行
$mail->WordWrap = 50;
// 加附件
//$mail->AddAttachment("/var/tmp/file.tar.gz");
// 附件,也可选加命名附件
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");
// 设置邮件格式为 HTML
$mail->IsHTML(true);
// 标题
$mail->Subject = "请迅速给我回邮件,好么";
// 内容
$mail->Body = '邮件内容为空';
// 附加内容
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
//$mail->Send()为邮件发送函数,不成功时执行if内容
if(!$mail->Send())
{
echo "Message could not be sent. ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
相关阅读 更多 +