KBMail.class.php 문제 해결

wp_mail 함수가 문제가 있어 잘 가지 않는것을 확인, 변경하여 문제를 해결하였습니다. 그 방법을 공유해드립니다.

1. WP-Mail-SMTP 플러그인을 설치 (SMTP 에 대한 SSL 혹은 TLS 이용, 계정을 통한 인증을 위해 개별 설정하여 설치합니다.)

2. kboard\class 에 있는 KBMail.class.php 를 아래와 같이 수정합니다.

<?php
/**
 * KBoard 메일
 * @link www.cosmosfarm.com
 * @copyright Copyright 2013 Cosmosfarm. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl.html
 */
class KBMail {

	var $to;
	var $title;
	var $content;

	public function send(){
		$admin_email = get_option('admin_email');
		
		if(is_array($this->to)){
			$this->to = implode(',', $this->to);
			$this->to = str_replace(' ', '', $this->to);
		}
		$to = $this->to;
		
		$headers = 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
		$headers .= 'To: ' . $this->to . "\r\n";
		$headers .= 'From: ' . $admin_email . "\r\n";
		
		$title = '['.__('KBoard new document', 'kboard').'] ' . $this->title;
		$content = nl2br(kboard_htmlclear($this->content)) . '<br><br><a href="'.site_url().'" onclick="window.open(this.href); return false;">'.site_url().'</a>';
		
		$result = wp_mail($to, $title, $content, $headers);
		return $result;
	}
}
?>

저장후 정상 동작하는 이메일 알림 서비스 이용하세요~

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요