From c10f1960750444782a31c895df05511941c6f86c Mon Sep 17 00:00:00 2001 From: thisgun Date: Mon, 5 Apr 2021 15:51:49 +0900 Subject: [PATCH] =?UTF-8?q?php=205.3=20=EB=B2=84=EC=A0=84=20=EC=9D=B4?= =?UTF-8?q?=ED=95=98=EC=97=90=EC=84=9C=20=EB=A9=94=EC=9D=BC=EC=9D=84=20?= =?UTF-8?q?=EB=B3=B4=EB=82=BC=EC=88=98=20=EC=97=86=EB=8A=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20HOOK=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mailer.lib.php | 61 ++++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/lib/mailer.lib.php b/lib/mailer.lib.php index 229ed97d9..10a0fcc46 100644 --- a/lib/mailer.lib.php +++ b/lib/mailer.lib.php @@ -18,35 +18,48 @@ function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc= $result = run_replace('mailer', $fname, $fmail, $to, $subject, $content, $type, $file, $cc, $bcc); - if( isset($result['return']) ){ + if( is_array($result) && isset($result['return']) ){ return $result['return']; } - $mail = new PHPMailer(); // defaults to using php "mail()" - if (defined('G5_SMTP') && G5_SMTP) { - $mail->IsSMTP(); // telling the class to use SMTP - $mail->Host = G5_SMTP; // SMTP server - if(defined('G5_SMTP_PORT') && G5_SMTP_PORT) - $mail->Port = G5_SMTP_PORT; - } - $mail->CharSet = 'UTF-8'; - $mail->From = $fmail; - $mail->FromName = $fname; - $mail->Subject = $subject; - $mail->AltBody = ""; // optional, comment out and test - $mail->msgHTML($content); - $mail->addAddress($to); - if ($cc) - $mail->addCC($cc); - if ($bcc) - $mail->addBCC($bcc); - //print_r2($file); exit; - if ($file != "") { - foreach ($file as $f) { - $mail->addAttachment($f['path'], $f['name']); + $mail_send_result = false; + + try { + $mail = new PHPMailer(); // defaults to using php "mail()" + if (defined('G5_SMTP') && G5_SMTP) { + $mail->IsSMTP(); // telling the class to use SMTP + $mail->Host = G5_SMTP; // SMTP server + if(defined('G5_SMTP_PORT') && G5_SMTP_PORT) + $mail->Port = G5_SMTP_PORT; } + $mail->CharSet = 'UTF-8'; + $mail->From = $fmail; + $mail->FromName = $fname; + $mail->Subject = $subject; + $mail->AltBody = ""; // optional, comment out and test + $mail->msgHTML($content); + $mail->addAddress($to); + if ($cc) + $mail->addCC($cc); + if ($bcc) + $mail->addBCC($bcc); + //print_r2($file); exit; + if ($file != "") { + foreach ($file as $f) { + $mail->addAttachment($f['path'], $f['name']); + } + } + + $mail = run_replace('mail_options', $mail, $fname, $fmail, $to, $subject, $content, $type, $file, $cc, $bcc); + + $mail_send_result = $mail->send(); + + } catch (Exception $e) { } - return $mail->send(); + + run_event('mail_send_result', $mail_send_result, $mail, $to, $cc, $bcc); + + return $mail_send_result; } // 파일을 첨부함