include_once("header.php");?>
include_once("menu.php");
include("_config/class.phpmailer.php");
$to=$_POST['recivers'];
$rs=split(",",$to);
$subject="來自你的朋友 ".$_POST['name']."在香港週的分享郵件";
$from=$_POST['email'];
$name=$_POST['name'];
$cc=$_POST['email'];
$link=$_SERVER['HTTP_HOST'];
$img='
';
$content=$_POST['desc'].$img;
//$aaa="aaaa,bbbb,cccc,dddd";
//$rs = split(",",$aaa);
if(isset($_POST['act']) && $_POST['act'] =='act'){
if(isset($_POST['isToSelf'])){
$return =sendMail($rs,$subject,$from,$name,$content,$cc);
/*print_r($va);*/
}else{
$return = sendMail($rs,$subject,$from,$name,$content);
}
if($return=='yes'){
echo '';
}else{
echo '';
}
}
function sendMail($rs,$subject,$from,$name,$content,$cc=NULL){
$mail= new PHPMailer(); //建立新物件
$mail->IsSMTP(); //設定使用SMTP方式寄信
$mail->Host = "localhost"; //設定SMTP主機
$mail->Port = 25; //設定SMTP埠位,預設為25埠。
$mail->CharSet = "utf-8"; //設定郵件編碼
$mail->Encoding = "base64";//設定信件編碼,大部分郵件工具都支援此編碼方式
$mail->IsHTML(true);//設置郵件格式為HTML
$mail->WordWrap = 50;
$mail->From = $from; //設定寄件者信箱
$mail->FromName =$name; //設定寄件者姓名
foreach($rs as $va){
$mail->AddAddress($va);//收件者
}
$mail->Subject = $subject;
$mail->Body = $content;
if(!$cc==NULL){
$mail->AddCC($cc); //副本
}
if(!$mail->Send())
{
/*
echo '';
*/
/*$msg = "郵件送出失敗!\r\n";
$msg .= "錯誤訊息: " . $mail->ErrorInfo . "\r\n"; */
return 'no';
}else{
/*echo '';
*/
/*$msg ="發送成功啦";*/
return 'yes';
}
}
?>
|
include_once("footer.php");?>