웹마스터 팁

서버를 PHP5.6으로 교체했는데 메일이 작동안하더군요..

smtp connect() failed라는 에러가 뜰때 대처방법을 기록차원으로 남겨둡니다.

 

우선 phpmailer를 최신버전으로 받습니다. ( https://github.com/PHPMailer/PHPMailer )

 

class.smtp.php를 smtp.php로 class.phpmailer.php를 phpmailer.php로 바꾸고

./libs/phpmailer에 smtp.php와 phpmailer.php에 덮어쓰기 해줍니다. (만일을 대비해 백업해주세요)

 

phpmailer.php에서 클래스 시작전에 require_once 'smtp.php';를 입력해주세요.

 

require_once 'smtp.php';

class PHPMailer
{
    /**
     * The PHPMailer Version number.

 

1285번째줄 근처에 smtpConnect 함수 시작부분에

$options = array_merge(array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false)),$options);

를 입력해주세요.

 

public function smtpConnect($options = array())
{
$options = array_merge(array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false)),$options);

if (is_null($this->smtp)) {

 

./classes/mail/mail.class.php를 열어 152번째줄 useGmailAccount 함수에서

$this->SMTPSecure = "ssl";

$this->Port = '465';

수정해줍시다.

 

function useGmailAccount($account_name, $account_passwd)
{
$this->SMTPAuth = TRUE;
$this->SMTPSecure = "ssl";
$this->Host = 'smtp.gmail.com';
$this->Port = '465';

 

 

openSSL에 문제가 있어 작동하지 않은듯 합니다..

 

인증메일을 보내려면 ./classes/mail/mail.class.php 140번째줄 Mail() 함수에

$this->useGmailAccount("아이디", "이메일"); 를 추가해주셔야합니다.

 

function Mail()
{
$this->useGmailAccount("아이디", "암호");
}

 

 

수정파일 올려둡니다. mail.zip