Files
core/f_func/class._Mail.php
T
Hide_D 7e0940d57d ?> 제거
replace 코드 디버깅 용도로 제거
2018-01-14 02:31:25 +09:00

41 lines
1.2 KiB
PHP

<?php
require_once('_common.php');
require_once(ROOT.W.E_LIB.W.'phpmailer5/class.phpmailer.php');
class _Mail {
private $objMail;
public function __construct($host, $port, $id, $pw, $addr) {
$this->objMail = new PHPMailer();
$this->objMail->IsSMTP();
$this->objMail->SMTPAuth = true;
$this->objMail->SMTPSecure = 'ssl';
$this->objMail->Host = $host;
$this->objMail->Port = $port;
$this->objMail->Username = $id;
$this->objMail->Password = $pw;
$this->objMail->ContentType = 'text/plain';
$this->objMail->CharSet = 'utf-8';
$this->objMail->Encoding = 'base64';
$this->objMail->SetFrom($addr);
}
public function Send($to, $subject, $content) {
$this->objMail->AddAddress($to);
$this->objMail->Subject = '=?utf-8?b?'.base64_encode($subject).'?=';
$this->objMail->Body = $content;
if(!$this->objMail->Send()) {
$result['msg'] = $this->objMail->ErrorInfo;
$result['result'] = 1;
} else {
$result['msg'] = 'Successfully sent.';
$result['result'] = 0;
}
return $result;
}
}