www.gusucode.com > weenCompany闻名企业网站系统 4.0.0 繁体中英文 UTF8源码程序 > install/step/checkMail.php
<?php // +---------------------------------------------+ // | Copyright 2007 - 2009 weenCompany | // | http://www.weentech.com | // | This file may not be redistributed. | // +---------------------------------------------+ function sendMail($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort = 25) { include(INSTALL_PATH.'/../includes/mail/class.phpmailer.php'); $mail = new PHPMailer(); if($smtpChecked =='smtp') $mail->IsSMTP(); else $mail->IsMail(); $mail->Host = $smtpServer; $mail->Port = $smtpPort; $mail->CharSet = "utf8"; $mail->Encoding = "base64"; $mail->SMTPAuth = true; $mail->Username = $smtpLogin; $mail->Password = $smtpPassword; $mail->From = $from; $mail->FromName = 'weenCompany Test Mail'; $mail->AddAddress($to); $mail->Subject = $subject; $mail->Body = $content; return $mail->Send(); } $smtpChecked = (trim($_GET['mailMethod']) == 'smtp'); $smtpServer = $_GET['smtpSrv']; $content = $_GET['testMsg']; $subject = $_GET['testSubject']; $type = 'text/html'; $to = $_GET['testEmail']; $from = 'no-reply@'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8'); $smtpLogin = $_GET['smtpLogin']; $smtpPassword = $_GET['smtpPassword']; $smtpPort = $_GET['smtpPort']; $result = sendMail($smtpChecked, $smtpServer, $content, $subject, $type, $to, $from, $smtpLogin, $smtpPassword, $smtpPort); die($result ? '<action result="ok"/>' : '<action result="fail"/>'); ?>