<?php
    include("class.phpmailer.php"); //包含phpmailer类

    $mail = new PHPMailer(); //建立邮件发送类
    $mail->IsSMTP(); //设定使用SMTP方式寄信

    $mail->CharSet = "gb2312"; //邮件的编码格式
    $mail->Host = "smtp.126.com"; //SMTP服务器地址
    $mail->SMTPAuth = true; //设定SMTP需要验证
    //$mail->SMTPSecure = "ssl"; // Gmail的SMTP主机需要使用SSL连接
    $mail->Port = 25; //端口号
    $mail->Username = "xingdong1117@126.com"; //邮箱账号
    $mail->Password = "XXXXXXXX"; //邮箱密码

    $mail->From = "xingdong1117@126.com"; //寄件者信箱
    $mail->FromName = "邢栋"; //寄件者姓名

    $mail->Subject = "smtp邮件发送测试";  //邮件标题
    $mail->Body = "smtp发送测试的邮件内容"; //邮件内容

    $mail->IsHTML(true); //邮件内容
    //$mail->AddAttachment("a.php"); // 添加附件 
    $mail->AddAddress("xingdong1117@qq.com"); //收件者

    if(!$mail->Send()) {
        echo "发送错误: " . $mail->ErrorInfo;
    } else {
        echo "<div align=center>邮件发送成功,请注意查收!</div>";
    }

?>