function mailto($nickname, $address) { $this->load->helper('url'); date_default_timezone_set('PRC'); include_once("application/controllers/class.phpmailer.php"); $mail = new PHPMailer(); // defaults to using php "mail()" $mail->IsSMTP(); // telling the class to use SMTP $mail->IsHTML(true); $mail->Host = "mail.wesleynet.com"; // SMTP server $mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail.wesleynet.com"; // sets the SMTP server $mail->Port = 26; // set the SMTP port for the GMAIL server $mail->Username = "support@wesleynet.com"; // SMTP account username $mail->Password = wpc123; // SMTP account password $mail->CharSet="utf-8"; //$body = file_get_contents('application/views/nmra/register.html'); //$body = preg_replace('/\\\\/','', $body); //Strip backslashes $body = ''; $body .= '
'; //$body .= '
'; $body .= '

'.$nickname.',您好。

'; $body .= '请点击以下链接验证您的邮箱,请注意域名为bkjia.com:'.base_url().'accounts/activation/'; $body .= '

顺祝工作学习愉快,生活舒心。

'; $body .= '
'; //echo $body; //To address and name $mail->addAddress("choonhwa@wesleynet.com", "Choon Hwa"); $mail->addAddress("4choonhwatan@gmail.com"); //Recipient name is optional //Address to which recipient will reply $mail->addReplyTo("test@wesleynet.com", "Reply"); //CC and BCC $mail->addCC("tanchoonhwa@hotmail.com"); $mail->addBCC("choonhwatan@yahoo.com"); $subject = "收到来自帮客之家的邮件"; $mail->Subject = "=?UTF-8?B?".base64_encode($subject)."?="; // optional, comment out and test $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); //$mail->AddAttachment("images/phpmailer.gif"); // attachment //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) { //echo "Mailer Error: " . $mail->ErrorInfo; } else { //echo "Message sent!"; } } OK,现在网站程序就能发邮件了