<?php
/*
* Created on 2013-1-19
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include("class/class.phpmailer.php"); //匯入PHPMailer類別 // class是一个文件夹,是 phpmail 库
$mail= new PHPMailer(); //建立新物件
$mail->IsSMTP(); //設定使用SMTP方式寄信
$mail->SMTPAuth = true; //設定SMTP需要驗證
$mail->SMTPSecure = "ssl"; // Gmail的SMTP主機需要使用SSL連線
$mail->Host = "smtp.xxx.com"; //Gamil的SMTP主機
$mail->Port = 465; //Gamil的SMTP主機的SMTP埠位為465埠。
$mail->CharSet = "gb2312"; //設定郵件編碼
$mail->Password = "xxxx"; //設定驗證密碼
$mail->FromName = utf82gb($_POST['title']); //設定寄件者姓名
$title = '来自于http://'.$_SERVER['HTTP_HOST'].' '.$_POST['title'].date('Y-m-d H:s:i').'报名';
$title = utf82gb($title);
$mail->Subject =$title; //設定郵件標題
//邮件正文
$body = '来自于'.$_POST['fromurl'].'<br />
';
$body .= $_POST['title']."于".date('Y-m-d H:s:i')."进行网上报名".'<br />
';
$body .= "性别为:".$_POST['sex'].'<br />
';
$body .= "电话为:".$_POST['tel'].'<br />
';
$body .= "专业为:".$_POST['zuauye'].'<br />
';
$body .= "QQ为:".$_POST['qq'].'<br />
';
$body .= "电子邮件为:".$_POST['email'].'<br />
';
$body .= "IP为:".$userip.'<br />
';
$body = utf82gb($body);
$mail->Body = $body; //設定郵件內容
$mail->IsHTML(true); //設定郵件內容為HTML
$mail->
AddAddress(
'1111@qq.com',
utf82gb(
"aaa"));
//設定收件者郵件及名稱
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
}