Add advanced mailer module

This commit is contained in:
Kijin Sung 2016-05-22 23:50:15 +09:00
parent 0961253a74
commit f9394ca26d
26 changed files with 1997 additions and 0 deletions

View file

@ -0,0 +1,304 @@
<?php
/**
* @file advanced_mailer.admin.controller.php
* @author Kijin Sung <kijin@kijinsung.com>
* @license GPLv2 or Later <https://www.gnu.org/licenses/gpl-2.0.html>
* @brief Advanced Mailer Admin Controller
*/
class Advanced_MailerAdminController extends Advanced_Mailer
{
/**
* Save the basic configuration.
*/
public function procAdvanced_MailerAdminInsertConfig()
{
// Get and validate the new configuration.
$vars = Context::getRequestVars();
if (!$vars->sender_name)
{
return new Object(-1, 'msg_advanced_mailer_sender_name_is_empty');
}
if (!$vars->sender_email)
{
return new Object(-1, 'msg_advanced_mailer_sender_email_is_empty');
}
if (!Mail::isVaildMailAddress($vars->sender_email))
{
return new Object(-1, 'msg_advanced_mailer_sender_email_is_invalid');
}
if ($vars->reply_to && !Mail::isVaildMailAddress($vars->reply_to))
{
return new Object(-1, 'msg_advanced_mailer_reply_to_is_invalid');
}
// Validate the sending method.
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
$sending_method = $vars->sending_method;
if (!array_key_exists($sending_method, $sending_methods))
{
return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid');
}
// Validate the configuration for the selected sending method.
$sending_method_config = array();
foreach ($sending_methods[$sending_method]['required'] as $conf_name)
{
$conf_value = $vars->{$sending_method . '_' . $conf_name} ?: null;
if (!$conf_value)
{
return new Object(-1, 'msg_advanced_mailer_smtp_host_is_invalid');
}
$sending_method_config[$conf_name] = $conf_value;
}
// Update the current module's configuration.
$config = $this->getConfig();
$config->sender_name = $vars->sender_name;
$config->sender_email = $vars->sender_email;
$config->reply_to = $vars->reply_to;
$config->force_sender = toBool($vars->force_sender);
$config->log_sent_mail = toBool($vars->log_sent_mail);
$config->log_errors = toBool($vars->log_errors);
$output = getController('module')->insertModuleConfig('advanced_mailer', $config);
if ($output->toBool())
{
$this->setMessage('success_registed');
}
else
{
return $output;
}
// Update the webmaster's name and email in the member module.
getController('module')->updateModuleConfig('member', (object)array(
'webmaster_name' => $config->sender_name,
'webmaster_email' => $config->sender_email,
));
// Update system configuration.
Rhymix\Framework\Config::set("mail.type", $sending_method);
Rhymix\Framework\Config::set("mail.$sending_method", $sending_method_config);
Rhymix\Framework\Config::save();
if (Context::get('success_return_url'))
{
$this->setRedirectUrl(Context::get('success_return_url'));
}
else
{
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminConfig'));
}
}
/**
* Save the exception configuration.
*/
public function procAdvanced_MailerAdminInsertExceptions()
{
// Get the current configuration.
$config = $this->getConfig();
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
// Get and validate the list of exceptions.
$exceptions = array();
for ($i = 1; $i <= 3; $i++)
{
$method = strval(Context::get('exception_' . $i . '_method'));
$domains = trim(Context::get('exception_' . $i . '_domains'));
if ($method !== '' && $domains !== '')
{
if ($method !== 'default' && !isset($sending_methods[$method]))
{
return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid');
}
if ($method !== 'default')
{
foreach ($this->sending_methods[$method]['required'] as $conf_name)
{
if (!Rhymix\Framework\Config::get("mail.$method.$conf_name"))
{
return new Object(-1, sprintf(
Context::getLang('msg_advanced_mailer_sending_method_is_not_configured'),
Context::getLang('cmd_advanced_mailer_sending_method_' . $method)));
}
}
}
$exceptions[$i]['method'] = $method;
$exceptions[$i]['domains'] = array();
$domains = array_map('trim', preg_split('/[,\n]/', $domains, null, PREG_SPLIT_NO_EMPTY));
foreach ($domains as $domain)
{
if (strpos($domain, 'xn--') !== false)
{
$domain = Rhymix\Framework\URL::decodeIdna($domain);
}
$exceptions[$i]['domains'][] = $domain;
}
}
}
// Save the new configuration.
$config->exceptions = $exceptions;
$output = getController('module')->insertModuleConfig('advanced_mailer', $config);
if ($output->toBool())
{
$this->setMessage('success_registed');
}
else
{
return $output;
}
if (Context::get('success_return_url'))
{
$this->setRedirectUrl(Context::get('success_return_url'));
}
else
{
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminExceptions'));
}
}
/**
* Check the DNS record of a domain.
*/
public function procAdvanced_MailerAdminCheckDNSRecord()
{
$check_config = Context::gets('hostname', 'record_type');
if (!preg_match('/^[a-z0-9_.-]+$/', $check_config->hostname))
{
$this->add('record_content', false);
return;
}
if (!defined('DNS_' . $check_config->record_type))
{
$this->add('record_content', false);
return;
}
$records = @dns_get_record($check_config->hostname, constant('DNS_' . $check_config->record_type));
if ($records === false)
{
$this->add('record_content', false);
return;
}
$return_values = array();
foreach ($records as $record)
{
if (isset($record[strtolower($check_config->record_type)]))
{
$return_values[] = $record[strtolower($check_config->record_type)];
}
}
$this->add('record_content', implode("\n\n", $return_values));
return;
}
/**
* Clear old sending log.
*/
public function procAdvanced_mailerAdminClearSentMail()
{
$status = Context::get('status');
$clear_before_days = intval(Context::get('clear_before_days'));
if (!in_array($status, array('success', 'error')))
{
return new Object(-1, 'msg_invalid_request');
}
if ($clear_before_days < 0)
{
return new Object(-1, 'msg_invalid_request');
}
$obj = new stdClass();
$obj->status = $status;
$obj->regdate = date('YmdHis', time() - ($clear_before_days * 86400) + zgap());
$output = executeQuery('advanced_mailer.deleteLogs', $obj);
if ($status === 'success')
{
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSentMail'));
}
else
{
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminErrors'));
}
}
/**
* Send a test email using a temporary configuration.
*/
public function procAdvanced_MailerAdminTestSend()
{
$advanced_mailer_config = $this->getConfig();
$recipient_config = Context::gets('recipient_name', 'recipient_email');
$recipient_name = $recipient_config->recipient_name;
$recipient_email = $recipient_config->recipient_email;
if (!$recipient_name)
{
$this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_name_is_empty'));
return;
}
if (!$recipient_email)
{
$this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_email_is_empty'));
return;
}
if (!Mail::isVaildMailAddress($recipient_email))
{
$this->add('test_result', 'Error: ' . Context::getLang('msg_advanced_mailer_recipient_email_is_invalid'));
return;
}
try
{
$oMail = new Rhymix\Framework\Mail();
$oMail->setTitle('Advanced Mailer Test : ' . strtoupper(config('mail.type')));
$oMail->setContent('<p>This is a <b>test email</b> from Advanced Mailer.</p><p>Thank you for trying Advanced Mailer.</p>' .
'<p>고급 메일 발송 모듈 <b>테스트</b> 메일입니다.</p><p>메일이 정상적으로 발송되고 있습니다.</p>');
$oMail->setFrom($advanced_mailer_config->sender_email, $advanced_mailer_config->sender_name);
$oMail->addTo($recipient_email, $recipient_name);
$result = $oMail->send();
if (!$result)
{
if (count($oMail->errors))
{
if (config('mail.type') === 'smtp')
{
if (strpos(config('mail.smtp.smtp_host'), 'gmail.com') !== false && strpos(implode("\n", $oMail->errors), 'code "535"') !== false)
{
$this->add('test_result', Context::getLang('msg_advanced_mailer_google_account_security'));
return;
}
if (strpos(config('mail.smtp.smtp_host'), 'naver.com') !== false && strpos(implode("\n", $oMail->errors), 'Failed to authenticate') !== false)
{
$this->add('test_result', Context::getLang('msg_advanced_mailer_naver_smtp_disabled'));
return;
}
}
$this->add('test_result', nl2br(htmlspecialchars(implode("\n", $oMail->errors))));
return;
}
else
{
$this->add('test_result', Context::getLang('msg_advanced_mailer_unknown_error'));
return;
}
}
}
catch (Exception $e)
{
$this->add('test_result', nl2br(htmlspecialchars($e->getMessage())));
return;
}
$this->add('test_result', Context::getLang('msg_advanced_mailer_test_success'));
return;
}
}

View file

@ -0,0 +1,256 @@
<?php
/**
* @file advanced_mailer.admin.view.php
* @author Kijin Sung <kijin@kijinsung.com>
* @license GPLv2 or Later <https://www.gnu.org/licenses/gpl-2.0.html>
* @brief Advanced Mailer Admin View
*/
class Advanced_MailerAdminView extends Advanced_Mailer
{
/**
* Display the general configuration form.
*/
public function dispAdvanced_MailerAdminConfig()
{
$advanced_mailer_config = $this->getConfig();
$member_config = getModel('module')->getModuleConfig('member');
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
Context::set('advanced_mailer_config', $advanced_mailer_config);
Context::set('sending_methods', $sending_methods);
Context::set('sending_method', config('mail.type'));
Context::set('webmaster_name', $member_config->webmaster_name ? $member_config->webmaster_name : 'webmaster');
Context::set('webmaster_email', $member_config->webmaster_email);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('config');
}
/**
* Display the exception domains configuration form.
*/
public function dispAdvanced_MailerAdminExceptions()
{
$advanced_mailer_config = $this->getConfig();
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
for ($i = 1; $i <= 3; $i++)
{
if (!isset($advanced_mailer_config->exceptions[$i]))
{
$advanced_mailer_config->exceptions[$i] = array('method' => '', 'domains' => array());
}
elseif ($advanced_mailer_config->exceptions[$i]['method'] === 'mail')
{
$advanced_mailer_config->exceptions[$i]['method'] = 'mailfunction';
}
}
Context::set('advanced_mailer_config', $advanced_mailer_config);
Context::set('sending_methods', $sending_methods);
Context::set('sending_method', config('mail.type'));
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('exceptions');
}
/**
* Display the SPF/DKIM setting guide.
*/
public function dispAdvanced_MailerAdminSpfDkim()
{
$advanced_mailer_config = $this->getConfig();
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
Context::set('advanced_mailer_config', $advanced_mailer_config);
Context::set('sending_methods', $sending_methods);
Context::set('sending_method', config('mail.type'));
if (strpos($advanced_mailer_config->sender_email, '@') !== false)
{
Context::set('sending_domain', substr(strrchr($advanced_mailer_config->sender_email, '@'), 1));
}
else
{
Context::set('sending_domain', preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']));
}
$used_methods = array(config('mail.type'));
$advanced_mailer_config->exceptions = $advanced_mailer_config->exceptions ?: array();
foreach ($advanced_mailer_config->exceptions as $exception)
{
if ($exception['method'] !== 'default' && $exception['method'] !== $used_methods[0] && count($exception['domains']))
{
$used_methods[] = $exception['method'];
}
}
Context::set('used_methods', $used_methods);
$used_methods_with_usable_spf = array();
$used_methods_with_usable_dkim = array();
foreach ($used_methods as $method)
{
if ($method === 'woorimail' && config('mail.woorimail.api_type') === 'free') continue;
if ($sending_methods[$method]['spf_hint'])
{
if (strpos($sending_methods[$method]['spf_hint'], '$SERVER_ADDR') !== false)
{
$used_methods_with_usable_spf[$method] = strtr($sending_methods[$method]['spf_hint'], array('$SERVER_ADDR' => $this->getServerIP()));
}
else
{
$used_methods_with_usable_spf[$method] = $sending_methods[$method]['spf_hint'];
}
}
if ($sending_methods[$method]['dkim_hint'])
{
$used_methods_with_usable_dkim[$method] = $sending_methods[$method]['dkim_hint'];
}
}
ksort($used_methods_with_usable_spf);
ksort($used_methods_with_usable_dkim);
Context::set('used_methods_with_usable_spf', $used_methods_with_usable_spf);
Context::set('used_methods_with_usable_dkim', $used_methods_with_usable_dkim);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('spf_dkim');
}
/**
* Display the test send form.
*/
public function dispAdvanced_MailerAdminTestConfig()
{
$advanced_mailer_config = $this->getConfig();
$sending_methods = Rhymix\Framework\Mail::getSupportedDrivers();
Context::set('advanced_mailer_config', $advanced_mailer_config);
Context::set('sending_methods', $sending_methods);
Context::set('sending_method', config('mail.type'));
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('test');
}
/**
* Display the sent mail log.
*/
public function dispAdvanced_MailerAdminSentMail()
{
$obj = new stdClass();
$obj->status = 'success';
$obj->page = $page = Context::get('page') ?: 1;
$maillog = executeQuery('advanced_mailer.getLogByType', $obj);
$maillog = $maillog->toBool() ? $this->procMailLog($maillog->data) : array();
Context::set('advanced_mailer_log', $maillog);
Context::set('advanced_mailer_status', 'success');
$paging = $this->procPaging('success', $page);
Context::set('total_count', $paging->total_count);
Context::set('total_page', $paging->total_page);
Context::set('page', $paging->page);
Context::set('page_navigation', $paging->page_navigation);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('view_log');
}
/**
* Display the error log.
*/
public function dispAdvanced_MailerAdminErrors()
{
$obj = new stdClass();
$obj->status = 'error';
$obj->page = $page = Context::get('page') ?: 1;
$maillog = executeQuery('advanced_mailer.getLogByType', $obj);
$maillog = $maillog->toBool() ? $this->procMailLog($maillog->data) : array();
Context::set('advanced_mailer_log', $maillog);
Context::set('advanced_mailer_status', 'error');
$paging = $this->procPaging('error', $page);
Context::set('total_count', $paging->total_count);
Context::set('total_page', $paging->total_page);
Context::set('page', $paging->page);
Context::set('page_navigation', $paging->page_navigation);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('view_log');
}
/**
* Process mail log for display.
*/
public function procMailLog($log)
{
foreach($log as $item)
{
$from = explode("\n", $item->mail_from);
foreach($from as &$fromitem)
{
if(preg_match('/^(.+) <([^>]+)>$/', $fromitem, $matches))
{
$fromitem = array($matches[2], $matches[1]);
}
else
{
$fromitem = array($fromitem, '');
}
}
$item->mail_from = $from;
$to = explode("\n", $item->mail_to);
foreach($to as &$toitem)
{
if(preg_match('/^(.+?) <([^>]+)>$/', $toitem, $matches))
{
$toitem = array($matches[2], $matches[1]);
}
else
{
$toitem = array($toitem, '');
}
}
$item->mail_to = $to;
}
return $log;
}
/**
* Process paging.
*/
public function procPaging($status, $page = 1)
{
$args = new stdClass;
$args->status = $status;
$count = executeQuery('advanced_mailer.countLogByType', $args);
$total_count = $count->data->count;
$total_page = max(1, ceil($total_count / 20));
$output = new Object();
$output->total_count = $total_count;
$output->total_page = $total_page;
$output->page = $page;
$output->page_navigation = new PageHandler($total_count, $total_page, $page, 10);
return $output;
}
/**
* Get the public IPv4 address of the current server.
*/
public function getServerIP()
{
if (isset($_SESSION['advanced_mailer_ip_cache']) && $_SESSION['advanced_mailer_ip_cache'][1] > time() - 3600)
{
return $_SESSION['advanced_mailer_ip_cache'][0];
}
else
{
$ip = trim(FileHandler::getRemoteResource('http://icanhazip.com/'));
$ip = preg_match('/^[0-9]+(\.[0-9]+){3}$/', $ip) ? $ip : false;
$_SESSION['advanced_mailer_ip_cache'] = array($ip, time());
return $ip;
}
}
}

View file

@ -0,0 +1,244 @@
<?php
/**
* @file advanced_mailer.class.php
* @author Kijin Sung <kijin@kijinsung.com>
* @license GPLv2 or Later <https://www.gnu.org/licenses/gpl-2.0.html>
* @brief Advanced Mailer Main Class
*/
class Advanced_Mailer extends ModuleObject
{
/**
* Get the configuration of the current module.
*/
public function getConfig()
{
$config = getModel('module')->getModuleConfig('advanced_mailer');
if (!is_object($config))
{
$config = new stdClass();
}
if (isset($config->is_enabled) || isset($config->sending_method) || isset($config->send_type))
{
$config = $this->migrateConfig($config);
getController('module')->insertModuleConfig('advanced_mailer', $config);
}
return $config;
}
/**
* Migrate from previous configuration format.
*/
public function migrateConfig($config)
{
$systemconfig = array();
if (isset($config->sending_method))
{
$systemconfig['mail.type'] = $config->sending_method;
}
elseif (isset($config->send_type))
{
$systemconfig['mail.type'] = $config->send_type;
}
if ($systemconfig['mail.type'] === 'mail')
{
$systemconfig['mail.type'] = 'mailfunction';
}
if (isset($config->username))
{
if (in_array('username', $this->sending_methods[$config->sending_method]['conf']))
{
$config->{$config->sending_method . '_username'} = $config->username;
}
unset($config->username);
}
if (isset($config->password))
{
if (in_array('password', $this->sending_methods[$config->sending_method]['conf']))
{
$config->{$config->sending_method . '_password'} = $config->password;
}
unset($config->password);
}
if (isset($config->domain))
{
if (in_array('domain', $this->sending_methods[$config->sending_method]['conf']))
{
$config->{$config->sending_method . '_domain'} = $config->domain;
}
unset($config->domain);
}
if (isset($config->api_key))
{
if (in_array('api_key', $this->sending_methods[$config->sending_method]['conf']))
{
$config->{$config->sending_method . '_api_key'} = $config->api_key;
}
unset($config->api_key);
}
if (isset($config->account_type))
{
if (in_array('account_type', $this->sending_methods[$config->sending_method]['conf']))
{
$config->{$config->sending_method . '_account_type'} = $config->account_type;
}
unset($config->account_type);
}
if (isset($config->aws_region))
{
$config->ses_region = $config->aws_region;
unset($config->aws_region);
}
if (isset($config->aws_access_key))
{
$config->ses_access_key = $config->aws_access_key;
unset($config->aws_access_key);
}
if (isset($config->aws_secret_key))
{
$config->ses_secret_key = $config->aws_secret_key;
unset($config->aws_secret_key);
}
$mail_drivers = Rhymix\Framework\Mail::getSupportedDrivers();
foreach ($mail_drivers as $driver_name => $driver_definition)
{
foreach ($config as $key => $value)
{
if (strncmp($key, $driver_name . '_', strlen($driver_name) + 1) === 0)
{
$subkey = substr($key, strlen($driver_name) + 1);
switch ($subkey)
{
case 'host':
case 'port':
case 'security':
$systemconfig["mail.$driver_name.smtp_" . $subkey] = $value;
break;
case 'username':
case 'password':
$systemconfig["mail.$driver_name." . ($driver_name === 'smtp' ? 'smtp_' : 'api_') . substr($subkey, 0, 4)] = $value;
break;
case 'account_type':
case 'region':
$systemconfig["mail.$driver_name.api_type"] = $value;
break;
case 'access_key':
$systemconfig["mail.$driver_name.api_user"] = $value;
break;
case 'secret_key':
$systemconfig["mail.$driver_name.api_pass"] = $value;
break;
case 'domain':
$systemconfig["mail.$driver_name.api_domain"] = $value;
break;
case 'api_key':
$systemconfig["mail.$driver_name.api_token"] = $value;
break;
default:
break;
}
unset($config->$key);
}
}
}
if (count($systemconfig))
{
foreach ($systemconfig as $key => $value)
{
Rhymix\Framework\Config::set($key, $value);
}
Rhymix\Framework\Config::save();
}
unset($config->is_enabled);
unset($config->sending_method);
unset($config->send_type);
$config->log_sent_mail = toBool($config->log_sent_mail);
$config->log_errors = toBool($config->log_errors);
$config->force_sender = toBool($config->force_sender);
if (!isset($config->exceptions))
{
$config->exceptions = array();
}
return $config;
}
/**
* Register triggers.
*/
public function registerTriggers()
{
$oModuleModel = getModel('module');
$oModuleController = getController('module');
if ($oModuleModel->getTrigger('moduleHandler.init', 'advanced_mailer', 'model', 'triggerReplaceMailClass', 'before'))
{
$oModuleController->deleteTrigger('moduleHandler.init', 'advanced_mailer', 'model', 'triggerReplaceMailClass', 'before');
}
if (!$oModuleModel->getTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerBeforeMailSend', 'before'))
{
$oModuleController->insertTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerBeforeMailSend', 'before');
}
if (!$oModuleModel->getTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerAfterMailSend', 'after'))
{
$oModuleController->insertTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerAfterMailSend', 'after');
}
}
/**
* Install.
*/
public function moduleInstall()
{
$this->registerTriggers();
return new Object();
}
/**
* Check update.
*/
public function checkUpdate()
{
$oModuleModel = getModel('module');
if ($oModuleModel->getTrigger('moduleHandler.init', 'advanced_mailer', 'model', 'triggerReplaceMailClass', 'before'))
{
return true;
}
if (!$oModuleModel->getTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerBeforeMailSend', 'before'))
{
return true;
}
if (!$oModuleModel->getTrigger('mail.send', 'advanced_mailer', 'controller', 'triggerAfterMailSend', 'after'))
{
return true;
}
return false;
}
/**
* Update.
*/
public function moduleUpdate()
{
$this->registerTriggers();
return new Object(0, 'success_updated');
}
public function recompileCache()
{
// no-op
}
}

View file

@ -0,0 +1,26 @@
<?php
/**
* @file advanced_mailer.controller.php
* @author Kijin Sung <kijin@kijinsung.com>
* @license GPLv2 or Later <https://www.gnu.org/licenses/gpl-2.0.html>
* @brief Advanced Mailer Model
*/
class Advanced_MailerController extends Advanced_Mailer
{
/**
* Before mail send trigger.
*/
public function triggerBeforeMailSend($mail)
{
}
/**
* After mail send trigger.
*/
public function triggerAfterMailSend($mail)
{
}
}

View file

@ -0,0 +1,18 @@
<?php
/**
* @file advanced_mailer.model.php
* @author Kijin Sung <kijin@kijinsung.com>
* @license GPLv2 or Later <https://www.gnu.org/licenses/gpl-2.0.html>
* @brief Advanced Mailer Model
*/
class Advanced_MailerModel extends Advanced_Mailer
{
/**
* @deprecated
*/
public function triggerReplaceMailClass()
{
}
}

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="0.2">
<title xml:lang="ko">고급 메일 발송 모듈</title>
<title xml:lang="en">Advanced Mailer</title>
<description xml:lang="ko">
외부 SMTP 서버 또는 API를 사용하여 메일을 발송합니다.
</description>
<description xml:lang="en">
Send mail using an external SMTP server or API service.
</description>
<version>2.0.0</version>
<date>2016-05-22</date>
<author email_address="kijin@kijinsung.com" link="https://github.com/kijin">
<name xml:lang="ko">Kijin Sung</name>
<name xml:lang="en">Kijin Sung</name>
</author>
</module>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<permissions />
<actions>
<action name="dispAdvanced_mailerAdminConfig" type="view" admin_index="true" menu_name="advanced_mailer" />
<action name="dispAdvanced_mailerAdminExceptions" type="view" />
<action name="dispAdvanced_mailerAdminSpfDkim" type="view" />
<action name="dispAdvanced_mailerAdminTestConfig" type="view" />
<action name="dispAdvanced_mailerAdminSentMail" type="view" />
<action name="dispAdvanced_mailerAdminErrors" type="view" />
<action name="procAdvanced_mailerAdminInsertConfig" type="controller" />
<action name="procAdvanced_mailerAdminInsertExceptions" type="controller" />
<action name="procAdvanced_mailerAdminCheckDNSRecord" type="controller" />
<action name="procAdvanced_mailerAdminClearSentMail" type="controller" />
<action name="procAdvanced_mailerAdminTestSend" type="controller" />
</actions>
<menus>
<menu name="advanced_mailer" type="all">
<title xml:lang="ko">고급 메일 발송 모듈</title>
<title xml:lang="en">Advanced Mailer</title>
</menu>
</menus>
</module>

View file

@ -0,0 +1,114 @@
<?php
$lang->cmd_advanced_mailer = 'Advanced Mailer';
$lang->cmd_advanced_mailer_general_config = 'General settings';
$lang->cmd_advanced_mailer_is_enabled = 'Enable module';
$lang->cmd_advanced_mailer_is_enabled_yes = 'Enabled';
$lang->cmd_advanced_mailer_is_enabled_no = 'Disabled';
$lang->cmd_advanced_mailer_logging = 'Logging';
$lang->cmd_advanced_mailer_log_sent_mail = 'Log Sent Mail';
$lang->cmd_advanced_mailer_log_errors = 'Log Errors';
$lang->cmd_advanced_mailer_log_yes = 'Yes';
$lang->cmd_advanced_mailer_log_no = 'No';
$lang->cmd_advanced_mailer_sending_method_config = 'Default Sending Method';
$lang->cmd_advanced_mailer_about_sending_method_config = 'Please fill all of the boxes.';
$lang->cmd_advanced_mailer_sending_method = 'Sending method';
$lang->cmd_advanced_mailer_about_sending_method = 'This method will be used for all emails where the recipient\'s email address does not belong to an <a href="./index.php?module=admin&amp;act=dispAdvanced_mailerAdminExceptions" target="_blank">exception domain</a>.';
$lang->cmd_advanced_mailer_sending_method_default = 'Default sending method';
$lang->cmd_advanced_mailer_sending_method_exceptions = 'Exceptions';
$lang->cmd_advanced_mailer_smtp_manual_entry = 'Manual entry';
$lang->cmd_advanced_mailer_smtp_host = 'SMTP host';
$lang->cmd_advanced_mailer_smtp_port = 'SMTP port';
$lang->cmd_advanced_mailer_smtp_security = 'SMTP security';
$lang->cmd_advanced_mailer_smtp_security_ssl = 'SSL';
$lang->cmd_advanced_mailer_smtp_security_tls = 'TLS (STARTTLS)';
$lang->cmd_advanced_mailer_smtp_security_none = 'None';
$lang->cmd_advanced_mailer_smtp_user = 'Username';
$lang->cmd_advanced_mailer_smtp_pass = 'Password';
$lang->cmd_advanced_mailer_api_domain = 'Domain';
$lang->cmd_advanced_mailer_api_token = 'API token';
$lang->cmd_advanced_mailer_api_type = 'API type';
$lang->cmd_advanced_mailer_api_type_free = 'Free account';
$lang->cmd_advanced_mailer_api_type_paid = 'Paid account';
$lang->cmd_advanced_mailer_api_user = 'Username';
$lang->cmd_advanced_mailer_api_pass = 'Password';
$lang->cmd_advanced_mailer_sender_identity = 'Sender Identity';
$lang->cmd_advanced_mailer_about_sender_identity = 'Sender identity will be applied to the webmaster\'s name and email address in the <a href="./index.php?module=admin&amp;act=dispMemberAdminConfig" target="_blank">member module</a> as well.';
$lang->cmd_advanced_mailer_sender_name = 'Sender\'s name';
$lang->cmd_advanced_mailer_sender_email = 'Sender\'s email';
$lang->cmd_advanced_mailer_reply_to = 'Reply-To email';
$lang->cmd_advanced_mailer_force_sender = 'Always Use This Email';
$lang->cmd_advanced_mailer_about_force_sender = 'Automatically change to the email address above if another module tries to send from a different address.';
$lang->cmd_advanced_mailer_about_force_sender_caution_line_1 = 'Caution: If you use SMTP with a free e-mail service, the sender\'s address must correspond to the SMTP login credentials.';
$lang->cmd_advanced_mailer_about_force_sender_caution_line_2 = 'The original sender\'s address will be used as Reply-To for your convenience.';
$lang->cmd_advanced_mailer_spf_dkim_setting = 'SPF/DKIM Setting Guide';
$lang->cmd_advanced_mailer_about_spf_dkim_setting = 'This is only applicable when sending emails from your own domain. Some APIs are not supported.';
$lang->cmd_advanced_mailer_not_applicable_because_sender_domain = 'Not applicable to the sender\'s domain.';
$lang->cmd_advanced_mailer_not_applicable_because_sending_method = 'Not applicable to the selected sending method.';
$lang->cmd_advanced_mailer_domain_count = '%d domains';
$lang->cmd_advanced_mailer_dns_hostname = 'DNS hostname';
$lang->cmd_advanced_mailer_txt_record = 'TXT record';
$lang->cmd_advanced_mailer_check = 'Check';
$lang->cmd_advanced_mailer_nothing_to_check = 'There is nothing to check.';
$lang->cmd_advanced_mailer_check_failure = 'Check failure.';
$lang->cmd_advanced_mailer_check_no_records = 'has no TXT records.';
$lang->cmd_advanced_mailer_check_result = 'has the following TXT records.';
$lang->cmd_advanced_mailer_other_info = 'Note';
$lang->cmd_advanced_mailer_other_info_mail_spf = 'In order to send mail to Korean recipients from your own server, please register a <a href="https://www.kisarbl.or.kr/" target="_blank">white domain</a> with KISA.';
$lang->cmd_advanced_mailer_other_info_ses_dkim = 'Please create three CNAME records according to the directions found in your AWS management console.';
$lang->cmd_advanced_mailer_other_info_mailgun_dkim = 'The DKIM hostname may be different from what is shown here.';
$lang->cmd_advanced_mailer_other_info_postmark_dkim = 'Please see the Sender Signatures page of your Postmark account for the exact DKIm hostname to use.';
$lang->cmd_advanced_mailer_other_info_woorimail_dkim = 'Please log into Woorimail to see your DKIM settings.';
$lang->cmd_advanced_mailer_ellipsis = '(see API for full value)';
$lang->cmd_advanced_mailer_test = 'Mail Test';
$lang->cmd_advanced_mailer_recipient_name = 'Recipient\'s name';
$lang->cmd_advanced_mailer_recipient_email = 'Recipient\'s email';
$lang->cmd_advanced_mailer_send = 'Send';
$lang->cmd_advanced_mailer_test_result = 'Test result';
$lang->cmd_advanced_mailer_exception_domains = 'Exception domains';
$lang->cmd_advanced_mailer_exception_disabled = 'Use default';
$lang->cmd_advanced_mailer_exception_domains_list = 'List of domains';
$lang->cmd_advanced_mailer_about_exception_domains_list = 'Domains should be separated by commas or line breaks. (Example: gmail.com, yahoo.com)';
$lang->cmd_advanced_mailer_about_exception_domains = 'When sending to domains listed here, the specified sending method will be used instead of the default.';
$lang->cmd_advanced_mailer_exception_group = 'Exception Group';
$lang->cmd_advanced_mailer_use_exceptions = 'Exception domains';
$lang->cmd_advanced_mailer_use_exceptions_yes = 'Test with exceptions as configured';
$lang->cmd_advanced_mailer_use_exceptions_no = 'Ignore exceptions and only test the default sending method';
$lang->msg_advanced_mailer_about_dummy = 'Dummy does not actually send any email. It only records them. Use this option for testing.';
$lang->msg_advanced_mailer_about_dummy_exceptions = 'Caution: if you have set up exception domains, email will be sent to those domains.';
$lang->msg_advanced_mailer_sending_method_is_invalid = 'Please select a valid sending method.';
$lang->msg_advanced_mailer_sending_method_is_not_configured = 'The selected sending method (%s) has not been fully configured. Please return to General Settings and finish configuring it.';
$lang->msg_advanced_mailer_smtp_host_is_invalid = 'Please enter a valid SMTP server name.';
$lang->msg_advanced_mailer_smtp_port_is_invalid = 'Please enter a valid SMTP port number.';
$lang->msg_advanced_mailer_smtp_security_is_invalid = 'Please select a valid SMTP security scheme.';
$lang->msg_advanced_mailer_username_is_empty = 'Please enter a username for the sending method you selected.';
$lang->msg_advanced_mailer_password_is_empty = 'Please enter a password for the sending method you selected.';
$lang->msg_advanced_mailer_aws_region_is_invalid = 'Please select a valid AWS Region.';
$lang->msg_advanced_mailer_aws_access_key_is_empty = 'Please enter a valid AWS Access Key.';
$lang->msg_advanced_mailer_aws_secret_key_is_empty = 'Please enter a valid AWS Secret Key.';
$lang->msg_advanced_mailer_domain_is_empty = 'Please enter a valid domain.';
$lang->msg_advanced_mailer_api_key_is_empty = 'Please enter a valid API Key.';
$lang->msg_advanced_mailer_sender_name_is_empty = 'Please enter the sender\'s name.';
$lang->msg_advanced_mailer_sender_email_is_empty = 'Please enter the sender\'s email address.';
$lang->msg_advanced_mailer_sender_email_is_invalid = 'The sender\'s email address is invalid.';
$lang->msg_advanced_mailer_reply_to_is_invalid = 'The Reply-To email address is invalid.';
$lang->msg_advanced_mailer_recipient_name_is_empty = 'Please enter the recipient\'s name.';
$lang->msg_advanced_mailer_recipient_email_is_empty = 'Please enter the recipient\'s email address.';
$lang->msg_advanced_mailer_recipient_email_is_invalid = 'The recipient\'s email address is invalid.';
$lang->msg_advanced_mailer_test_success = 'The test was successful. Please check your email.';
$lang->msg_advanced_mailer_google_account_security = 'Either your login credentials are incorrect, or the SMTP connection was blocked by Google account security settings.<br />Please <a href="https://support.google.com/mail/answer/14257" target="_blank">see here</a> for more information.';
$lang->msg_advanced_mailer_naver_smtp_disabled = 'Either your login credentials are incorrect, or POP3/SMTP is not enabled on your Naver account.';
$lang->msg_advanced_mailer_unknown_error = 'An unknown error occurred.';
$lang->msg_advanced_mailer_log_is_empty = 'There are no entries to display.';
$lang->cmd_advanced_mailer_status_sender = 'Sender';
$lang->cmd_advanced_mailer_status_recipient = 'Recipient';
$lang->cmd_advanced_mailer_status_subject = 'Subject';
$lang->cmd_advanced_mailer_status_sending_method = 'Method';
$lang->cmd_advanced_mailer_status_time = 'Time';
$lang->cmd_advanced_mailer_status = 'Status';
$lang->cmd_advanced_mailer_status_success = 'Success';
$lang->cmd_advanced_mailer_status_error = 'Error';
$lang->cmd_advanced_mailer_status_error_msg = 'Error message';
$lang->cmd_advanced_mailer_status_calling_script = 'Called from';
$lang->cmd_advanced_mailer_clear_log_condition_all = 'Everything';
$lang->cmd_advanced_mailer_clear_log_condition = 'Over %d days';
$lang->cmd_advanced_mailer_clear_log_button = 'Clear old logs';

View file

@ -0,0 +1,114 @@
<?php
$lang->cmd_advanced_mailer = '고급 메일 발송 모듈';
$lang->cmd_advanced_mailer_general_config = '기본 설정';
$lang->cmd_advanced_mailer_is_enabled = '모듈 사용';
$lang->cmd_advanced_mailer_is_enabled_yes = '사용';
$lang->cmd_advanced_mailer_is_enabled_no = '사용하지 않음';
$lang->cmd_advanced_mailer_logging = '발송 내역 기록';
$lang->cmd_advanced_mailer_log_sent_mail = '발송 내역';
$lang->cmd_advanced_mailer_log_errors = '에러 내역';
$lang->cmd_advanced_mailer_log_yes = '기록';
$lang->cmd_advanced_mailer_log_no = '기록하지 않음';
$lang->cmd_advanced_mailer_sending_method_config = '기본 발송 방법 설정';
$lang->cmd_advanced_mailer_about_sending_method_config = '반드시 모든 항목을 입력하시기 바랍니다.';
$lang->cmd_advanced_mailer_sending_method = '발송 방법';
$lang->cmd_advanced_mailer_about_sending_method = '받는이의 주소가 <a href="./index.php?module=admin&amp;act=dispAdvanced_mailerAdminExceptions" target="_blank">예외 도메인</a>에 해당하지 않을 경우 모두 이 방법으로 발송됩니다.';
$lang->cmd_advanced_mailer_sending_method_default = '기본 발송 방법';
$lang->cmd_advanced_mailer_sending_method_exceptions = '예외 발송 방법';
$lang->cmd_advanced_mailer_smtp_manual_entry = '직접 입력';
$lang->cmd_advanced_mailer_smtp_host = 'SMTP 서버';
$lang->cmd_advanced_mailer_smtp_port = 'SMTP 포트';
$lang->cmd_advanced_mailer_smtp_security = 'SMTP 보안';
$lang->cmd_advanced_mailer_smtp_security_ssl = 'SSL';
$lang->cmd_advanced_mailer_smtp_security_tls = 'TLS (STARTTLS)';
$lang->cmd_advanced_mailer_smtp_security_none = '사용하지 않음';
$lang->cmd_advanced_mailer_smtp_user = '아이디';
$lang->cmd_advanced_mailer_smtp_pass = '비밀번호';
$lang->cmd_advanced_mailer_api_domain = '도메인';
$lang->cmd_advanced_mailer_api_token = 'API 토큰';
$lang->cmd_advanced_mailer_api_type = 'API 구분';
$lang->cmd_advanced_mailer_api_type_free = '무료';
$lang->cmd_advanced_mailer_api_type_paid = '유료';
$lang->cmd_advanced_mailer_api_user = '아이디';
$lang->cmd_advanced_mailer_api_pass = '비밀번호';
$lang->cmd_advanced_mailer_sender_identity = '보낸이 설정';
$lang->cmd_advanced_mailer_about_sender_identity = '보낸이 설정은 <a href="./index.php?module=admin&amp;act=dispMemberAdminConfig" target="_blank">회원 모듈</a>의 웹마스터 이름 및 메일 주소에도 동일하게 적용됩니다.';
$lang->cmd_advanced_mailer_sender_name = '보낸이 이름';
$lang->cmd_advanced_mailer_sender_email = '보낸이 메일 주소';
$lang->cmd_advanced_mailer_reply_to = 'Reply-To 주소';
$lang->cmd_advanced_mailer_force_sender = '이 주소 외 사용 금지';
$lang->cmd_advanced_mailer_about_force_sender = '위에서 설정한 주소 외의 보낸이 주소를 사용할 경우 위에서 설정한 주소로 강제 변경합니다.';
$lang->cmd_advanced_mailer_about_force_sender_caution_line_1 = '포털 서비스의 SMTP를 사용할 경우 보낸이 메일 주소가 SMTP 로그인 정보와 반드시 일치해야 합니다.';
$lang->cmd_advanced_mailer_about_force_sender_caution_line_2 = '보낸이 주소를 강제 변경하더라도 원래 주소를 Reply-To로 지정하여 답장을 보내는 데는 지장이 없도록 합니다.';
$lang->cmd_advanced_mailer_spf_dkim_setting = 'SPF/DKIM 설정 안내';
$lang->cmd_advanced_mailer_about_spf_dkim_setting = '자신의 도메인에서 메일을 보내는 경우에만 해당됩니다. 일부 API는 지원하지 않거나 별도의 매뉴얼을 참고하셔야 합니다.';
$lang->cmd_advanced_mailer_not_applicable_because_sender_domain = '보내는 주소가 자신의 도메인이 아니므로 해당되지 않습니다.';
$lang->cmd_advanced_mailer_not_applicable_because_sending_method = '선택하신 발송 방법에는 해당되지 않습니다.';
$lang->cmd_advanced_mailer_domain_count = '도메인 %d개';
$lang->cmd_advanced_mailer_dns_hostname = 'DNS 호스트명';
$lang->cmd_advanced_mailer_txt_record = 'TXT 레코드 값';
$lang->cmd_advanced_mailer_check = '체크';
$lang->cmd_advanced_mailer_nothing_to_check = '체크할 것이 없습니다.';
$lang->cmd_advanced_mailer_check_failure = '체크에 실패했습니다.';
$lang->cmd_advanced_mailer_check_no_records = '호스트에는 TXT 레코드가 없습니다.';
$lang->cmd_advanced_mailer_check_result = '호스트의 TXT 레코드는 다음과 같습니다.';
$lang->cmd_advanced_mailer_other_info = '참고';
$lang->cmd_advanced_mailer_other_info_mail_spf = 'mail() 함수를 사용하려면 반드시 인터넷진흥원에 <a href="https://www.kisarbl.or.kr/" target="_blank">화이트 도메인</a> 등록을 하시기 바랍니다.';
$lang->cmd_advanced_mailer_other_info_ses_dkim = 'Amazon SES에서 DKIM을 사용하려면 관리 콘솔의 안내에 따라 3개의 CNAME 레코드를 생성해야 합니다.';
$lang->cmd_advanced_mailer_other_info_mailgun_dkim = 'DKIM 호스트명은 달라질 수 있습니다.';
$lang->cmd_advanced_mailer_other_info_postmark_dkim = '정확한 DKIM 호스트명은 Postmark 계정의 Sender Signatures 페이지를 참고하시기 바랍니다.';
$lang->cmd_advanced_mailer_other_info_woorimail_dkim = 'DKIM 설정은 우리메일에 로그인하여 확인하십시오.';
$lang->cmd_advanced_mailer_ellipsis = '(중략)';
$lang->cmd_advanced_mailer_test = '발송 테스트';
$lang->cmd_advanced_mailer_recipient_name = '받는이 이름';
$lang->cmd_advanced_mailer_recipient_email = '받는이 메일 주소';
$lang->cmd_advanced_mailer_send = '발송';
$lang->cmd_advanced_mailer_test_result = '테스트 결과';
$lang->cmd_advanced_mailer_exception_domains = '예외 도메인';
$lang->cmd_advanced_mailer_exception_disabled = '기본 발송 방법 사용';
$lang->cmd_advanced_mailer_exception_domains_list = '해당 도메인 목록';
$lang->cmd_advanced_mailer_about_exception_domains_list = '쉼표 또는 줄바꿈으로 구분하여 주십시오. (예: daum.net, hanmail.net)';
$lang->cmd_advanced_mailer_about_exception_domains = '목록에 나열된 도메인으로 메일을 보낼 때는 기본 발송 방법 대신 별도로 지정된 발송 방법을 사용합니다.';
$lang->cmd_advanced_mailer_exception_group = '예외 그룹';
$lang->cmd_advanced_mailer_use_exceptions = '예외 도메인 설정';
$lang->cmd_advanced_mailer_use_exceptions_yes = '예외 설정을 적용하여 테스트';
$lang->cmd_advanced_mailer_use_exceptions_no = '무시하고 기본 발송 방법만 테스트';
$lang->msg_advanced_mailer_about_dummy = '더미는 실제로 메일을 발송하지 않고 기록만 하는 옵션입니다. 테스트에 사용하십시오.';
$lang->msg_advanced_mailer_about_dummy_exceptions = '더미를 선택하더라도 예외 도메인을 지정한 경우 메일이 발송될 수 있으니 주의하십시오.';
$lang->msg_advanced_mailer_sending_method_is_invalid = '올바른 발송 방법을 선택해 주십시오.';
$lang->msg_advanced_mailer_sending_method_is_not_configured = '선택한 발송 방법(%s)이 완전히 설정되지 않았습니다. 기본 설정 페이지로 돌아가서 설정을 마쳐 주십시오.';
$lang->msg_advanced_mailer_smtp_host_is_invalid = '올바른 SMTP 서버 이름을 입력해 주십시오.';
$lang->msg_advanced_mailer_smtp_port_is_invalid = '올바른 SMTP 포트 번호를 입력해 주십시오.';
$lang->msg_advanced_mailer_smtp_security_is_invalid = '올바른 SMTP 보안 방식을 선택해 주십시오.';
$lang->msg_advanced_mailer_username_is_empty = '선택한 발송 방법에 필요한 아이디를 입력해 주십시오.';
$lang->msg_advanced_mailer_password_is_empty = '선택한 발송 방법에 필요한 비밀번호를 입력해 주십시오.';
$lang->msg_advanced_mailer_aws_region_is_invalid = '올바른 AWS Region을 선택해 주십시오.';
$lang->msg_advanced_mailer_aws_access_key_is_empty = 'AWS Access Key를 입력해 주십시오.';
$lang->msg_advanced_mailer_aws_secret_key_is_empty = 'AWS Secret Key를 입력해 주십시오.';
$lang->msg_advanced_mailer_domain_is_empty = '올바른 도메인을 입력해 주십시오.';
$lang->msg_advanced_mailer_api_key_is_empty = '올바른 API Key를 입력해 주십시오.';
$lang->msg_advanced_mailer_sender_name_is_empty = '보낸이 이름을 입력해 주십시오.';
$lang->msg_advanced_mailer_sender_email_is_empty = '보낸이 메일 주소를 입력해 주십시오.';
$lang->msg_advanced_mailer_sender_email_is_invalid = '보낸이 메일 주소가 올바른 메일 주소가 아닙니다.';
$lang->msg_advanced_mailer_reply_to_is_invalid = 'Reply-To 메일 주소가 올바른 메일 주소가 아닙니다.';
$lang->msg_advanced_mailer_recipient_name_is_empty = '받는이 이름을 입력해 주십시오.';
$lang->msg_advanced_mailer_recipient_email_is_empty = '받는이 메일 주소를 입력해 주십시오.';
$lang->msg_advanced_mailer_recipient_email_is_invalid = '받는이 메일 주소가 올바른 메일 주소가 아닙니다.';
$lang->msg_advanced_mailer_test_success = '테스트에 성공하였습니다. 메일을 확인해 보시기 바랍니다.';
$lang->msg_advanced_mailer_google_account_security = '아이디 또는 비밀번호가 틀렸거나, 구글 보안 설정 때문에 SMTP 접속이 차단되었습니다.<br />자세한 정보는 <a href="https://support.google.com/mail/answer/14257?hl=ko" target="_blank">여기</a>를 참고하시기 바랍니다.';
$lang->msg_advanced_mailer_naver_smtp_disabled = '아이디 또는 비밀번호가 틀렸거나, 네이버 계정 환경설정에서 POP3/SMTP를 사용하지 않도록 설정되어 있습니다.';
$lang->msg_advanced_mailer_unknown_error = '알 수 없는 오류가 발생하였습니다.';
$lang->msg_advanced_mailer_log_is_empty = '표시할 항목이 없습니다.';
$lang->cmd_advanced_mailer_status_sender = '보낸이';
$lang->cmd_advanced_mailer_status_recipient = '받는이';
$lang->cmd_advanced_mailer_status_subject = '제목';
$lang->cmd_advanced_mailer_status_sending_method = '발송 방법';
$lang->cmd_advanced_mailer_status_time = '발송 시간';
$lang->cmd_advanced_mailer_status = '상태';
$lang->cmd_advanced_mailer_status_success = '성공';
$lang->cmd_advanced_mailer_status_error = '에러';
$lang->cmd_advanced_mailer_status_error_msg = '에러 메시지';
$lang->cmd_advanced_mailer_status_calling_script = '호출 위치';
$lang->cmd_advanced_mailer_clear_log_condition_all = '모두';
$lang->cmd_advanced_mailer_clear_log_condition = '%d일 이상';
$lang->cmd_advanced_mailer_clear_log_button = '오래된 기록 삭제';

View file

@ -0,0 +1,11 @@
<query id="countLogByType" action="select">
<tables>
<table name="advanced_mailer_log" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="status" var="status" />
</conditions>
</query>

View file

@ -0,0 +1,9 @@
<query id="deleteLogs" action="delete">
<tables>
<table name="advanced_mailer_log" />
</tables>
<conditions>
<condition operation="equal" column="status" var="status" />
<condition operation="less" column="regdate" var="regdate" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,17 @@
<query id="getLogByType" action="select">
<tables>
<table name="advanced_mailer_log" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="status" var="status" />
</conditions>
<navigation>
<index var="sort_index" default="mail_id" order="desc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,15 @@
<query id="insertLog" action="insert">
<tables>
<table name="advanced_mailer_log" />
</tables>
<columns>
<column name="mail_from" var="mail_from" notnull="notnull" />
<column name="mail_to" var="mail_to" notnull="notnull" />
<column name="subject" var="subject" notnull="notnull" />
<column name="calling_script" var="calling_script" notnull="notnull" />
<column name="sending_method" var="sending_method" notnull="notnull" />
<column name="regdate" var="regdate" notnull="notnull" default="curdate()" />
<column name="status" var="status" notnull="notnull" default="success" />
<column name="errors" var="errors" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<table name="advanced_mailer_log">
<column name="mail_id" type="number" size="11" notnull="notnull" primary_key="primary_key" auto_increment="auto_increment" />
<column name="mail_from" type="varchar" size="250" notnull="notnull" />
<column name="mail_to" type="text" notnull="notnull" />
<column name="subject" type="varchar" size="250" notnull="notnull" />
<column name="calling_script" type="varchar" size="250" notnull="notnull" />
<column name="sending_method" type="varchar" size="40" notnull="notnull" />
<column name="regdate" type="date" notnull="notnull" index="idx_regdate" />
<column name="status" type="varchar" size="40" notnull="notnull" index="idx_status" />
<column name="errors" type="bigtext" />
</table>

View file

@ -0,0 +1,13 @@
<div class="x_page-header">
<h1>{$lang->cmd_advanced_mailer}</h1>
</div>
<ul class="x_nav x_nav-tabs">
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminConfig'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminConfig')}">{$lang->cmd_advanced_mailer_general_config}</a></li>
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminExceptions'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminExceptions')}">{$lang->cmd_advanced_mailer_exception_domains}</a></li>
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminSpfDkim'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSpfDkim')}">{$lang->cmd_advanced_mailer_spf_dkim_setting}</a></li>
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminTestConfig'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminTestConfig')}">{$lang->cmd_advanced_mailer_test}</a></li>
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminSentMail'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminSentMail')}">{$lang->cmd_advanced_mailer_log_sent_mail}</a></li>
<li class="x_active"|cond="$act == 'dispAdvanced_mailerAdminErrors'"><a href="{getUrl('', 'module', 'admin', 'act', 'dispAdvanced_mailerAdminErrors')}">{$lang->cmd_advanced_mailer_log_errors}</a></li>
</ul>

View file

@ -0,0 +1,230 @@
<include target="./common.html" />
<load target="css/config.css" />
<load target="js/config.js" />
<form class="x_form-horizontal" action="./" method="post" id="advanced_mailer">
<input type="hidden" name="module" value="advanced_mailer" />
<input type="hidden" name="act" value="procAdvanced_mailerAdminInsertConfig" />
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
<h2 style="padding-top:12px">{$lang->cmd_advanced_mailer_sending_method_config}</h2>
<div class="advanced_mailer_description">
※ {$lang->cmd_advanced_mailer_about_sending_method}
</div>
<div class="x_control-group show-always">
<label class="x_control-label" for="advanced_mailer_sending_method">{$lang->cmd_advanced_mailer_sending_method_default}</label>
<div class="x_controls">
<select name="sending_method" id="advanced_mailer_sending_method">
<!--@foreach($sending_methods as $driver_name => $driver_definition)-->
<option value="{$driver_name}" selected="selected"|cond="$sending_method === $driver_name">{$driver_definition['name']}</option>
<!--@end-->
</select>
</div>
</div>
<script type="text/javascript">
var advanced_mailer_sending_methods = {json_encode($sending_methods)};
</script>
<div class="x_control-group hidden-by-default show-for-dummy">
<label class="x_control-label"></label>
<div class="x_controls">
<p class="x_help-block">{$lang->msg_advanced_mailer_about_dummy}<br />{$lang->msg_advanced_mailer_about_dummy_exceptions}</p>
</div>
</div>
<!--@foreach($sending_methods as $driver_name => $driver_definition)-->
<!--@foreach($driver_definition['required'] as $conf_name)-->
{@ $conf_value = escape(config("mail.$driver_name.$conf_name"))}
<!--@if($conf_name === 'smtp_host')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_smtp_host">{$lang->cmd_advanced_mailer_smtp_host}</label>
<div class="x_controls">
<input type="text" name="{$driver_name}_smtp_host" id="advanced_mailer_{$driver_name}_smtp_host" value="{$conf_value}" />
<select id="advanced_mailer_{$driver_name}_manual_entry">
<option value="">{$lang->cmd_advanced_mailer_smtp_manual_entry}</option>
<option value="gmail">Gmail</option>
<option value="hanmail">Hanmail</option>
<option value="naver">Naver</option>
<option value="worksmobile">Works Mobile</option>
<option value="outlook">Outlook.com</option>
<option value="yahoo">Yahoo</option>
</select>
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'smtp_port')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_smtp_port">{$lang->cmd_advanced_mailer_smtp_port}</label>
<div class="x_controls">
<input type="text" name="{$driver_name}_smtp_port" id="advanced_mailer_{$driver_name}_smtp_port" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'smtp_security')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label">{$lang->cmd_advanced_mailer_smtp_security}</label>
<div class="x_controls">
<label class="x_inline" for="advanced_mailer_{$driver_name}_security_none"><input type="radio" name="{$driver_name}_smtp_security" id="advanced_mailer_{$driver_name}_security_none" value="none" checked="checked"|cond="!in_array($conf_value, array('ssl', 'tls'))" /> {$lang->cmd_advanced_mailer_smtp_security_none}</label>
<label class="x_inline" for="advanced_mailer_{$driver_name}_security_ssl"><input type="radio" name="{$driver_name}_smtp_security" id="advanced_mailer_{$driver_name}_security_ssl" value="ssl" checked="checked"|cond="$conf_value === 'ssl'" /> {$lang->cmd_advanced_mailer_smtp_security_ssl}</label>
<label class="x_inline" for="advanced_mailer_{$driver_name}_security_tls"><input type="radio" name="{$driver_name}_smtp_security" id="advanced_mailer_{$driver_name}_security_tls" value="tls" checked="checked"|cond="$conf_value === 'tls'" /> {$lang->cmd_advanced_mailer_smtp_security_tls}</label>
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'smtp_user')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_smtp_user">{$lang->cmd_advanced_mailer_smtp_user}</label>
<div class="x_controls">
<input type="text" name="{$driver_name}_smtp_user" id="advanced_mailer_{$driver_name}_smtp_user" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'smtp_pass')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_smtp_pass">{$lang->cmd_advanced_mailer_smtp_pass}</label>
<div class="x_controls">
<input type="smtp_pass" name="{$driver_name}_smtp_pass" id="advanced_mailer_{$driver_name}_smtp_pass" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'api_type')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_api_type">{$lang->cmd_advanced_mailer_api_type}</label>
<div class="x_controls">
<select id="advanced_mailer_{$driver_name}_api_type" name="{$driver_name}_api_type">
<!--@foreach($driver_definition['api_types'] as $api_type)-->
<option value="{$api_type}" selected="selected"|cond="$api_type === $conf_value">{$api_type}</option>
<!--@end-->
</select>
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'api_domain')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_api_domain">{$lang->cmd_advanced_mailer_api_domain}</label>
<div class="x_controls">
<input type="text" name="{$driver_name}_api_domain" id="advanced_mailer_{$driver_name}_api_domain" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'api_token')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_api_token">{$lang->cmd_advanced_mailer_api_token}</label>
<div class="x_controls full-width">
<input type="text" name="{$driver_name}_api_token" id="advanced_mailer_{$driver_name}_api_token" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'api_user')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_api_user">{$lang->cmd_advanced_mailer_api_user}</label>
<div class="x_controls">
<input type="text" name="{$driver_name}_api_user" id="advanced_mailer_{$driver_name}_api_user" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@if($conf_name === 'api_pass')-->
<div class="x_control-group hidden-by-default show-for-{$driver_name}">
<label class="x_control-label" for="advanced_mailer_{$driver_name}_api_pass">{$lang->cmd_advanced_mailer_api_pass}</label>
<div class="x_controls full-width">
<input type="password" name="{$driver_name}_api_pass" id="advanced_mailer_{$driver_name}_api_pass" value="{$conf_value}" />
</div>
</div>
<!--@end-->
<!--@end-->
<!--@end-->
</section>
<section class="section">
<h2 style="padding-top:12px">{$lang->cmd_advanced_mailer_sender_identity}</h2>
<div class="advanced_mailer_description">
※ {$lang->cmd_advanced_mailer_about_sender_identity}
</div>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_sender_name">{$lang->cmd_advanced_mailer_sender_name}</label>
<div class="x_controls">
<input type="text" name="sender_name" id="advanced_mailer_sender_name" value="{$webmaster_name}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_sender_email">{$lang->cmd_advanced_mailer_sender_email}</label>
<div class="x_controls">
<input type="text" name="sender_email" id="advanced_mailer_sender_email" value="{$webmaster_email}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_reply_to">{$lang->cmd_advanced_mailer_reply_to}</label>
<div class="x_controls">
<input type="text" name="reply_to" id="advanced_mailer_reply_to" value="{$advanced_mailer_config->reply_to}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_force_sender}</label>
<div class="x_controls">
<label for="advanced_mailer_force_sender">
<input type="checkbox" name="force_sender" id="advanced_mailer_force_sender" value="Y" checked="checked"|cond="toBool($advanced_mailer_config->force_sender)" />
{$lang->cmd_advanced_mailer_about_force_sender}
</label>
<p>※ {$lang->cmd_advanced_mailer_about_force_sender_caution_line_1}<br />※ {$lang->cmd_advanced_mailer_about_force_sender_caution_line_2}</p>
</div>
</div>
</section>
<section class="section">
<h2 style="padding-top:12px">{$lang->cmd_advanced_mailer_logging}</h2>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_log_sent_mail">{$lang->cmd_advanced_mailer_log_sent_mail}</label>
<div class="x_controls">
<select name="log_sent_mail" id="advanced_mailer_log_sent_mail">
<option value="Y" selected="selected"|cond="toBool($advanced_mailer_config->log_sent_mail)" />{$lang->cmd_advanced_mailer_log_yes}</option>
<option value="N" selected="selected"|cond="!toBool($advanced_mailer_config->log_sent_mail)" />{$lang->cmd_advanced_mailer_log_no}</option>
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_log_errors}</label>
<div class="x_controls">
<select name="log_errors" id="advanced_mailer_log_errors">
<option value="Y" selected="selected"|cond="toBool($advanced_mailer_config->log_errors)" />{$lang->cmd_advanced_mailer_log_yes}</option>
<option value="N" selected="selected"|cond="!toBool($advanced_mailer_config->log_errors)" />{$lang->cmd_advanced_mailer_log_no}</option>
</select>
</div>
</div>
</section>
<div class="btnArea x_clearfix">
<button type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_registration}</button>
</div>
</form>

View file

@ -0,0 +1,52 @@
#advanced_mailer_test_send {
padding: 3px 10px;
}
#advanced_mailer_test_result {
font-family: Consolas, monospace;
padding: 5px 0;
}
section {
margin-bottom: 10px !important;
}
input[type=password] {
font-family: "Segoe UI", Arial, sans-serif !important;
}
h2 {
padding-left: 10px;
padding-bottom: 2px;
font-size: 16px !important;
}
div.advanced_mailer_description {
margin-bottom: 10px;
margin-left: 10px;
}
div.hidden-by-default {
display: none;
}
div.full-width input {
width: 90% !important;
}
div.margin-top {
margin-top: 5px;
}
span.sender_info {
display: inline-block;
margin-top: 12px;
margin-left: 24px;
font-family: Consolas, monospace;
}
textarea.exception-domains {
width: 90% !important;
height: 80px !important;
}

View file

@ -0,0 +1,31 @@
div.advanced_mailer_description {
margin-bottom: 10px;
margin-left: 10px;
}
div.margin-top {
margin-top: 5px;
}
div.x_modal-body .monospace {
font-family: Consolas, monospace;
word-wrap: break-word;
word-break: break-word;
}
#spf_dkim_setting div.spf_dkim_item {
padding: 5px 0;
}
#spf_dkim_setting div.spf_dkim_separator {
border-top: 1px dotted #ddd;
margin: 8px 0;
}
#spf_dkim_setting span.label {
display: inline-block;
min-width: 94px;
}
#spf_dkim_setting span.monospace {
font-family: Consolas, monospace;
display: inline-block;
}

View file

@ -0,0 +1,4 @@
div.mail-log-errors {
display: none;
}

View file

@ -0,0 +1,67 @@
<include target="./common.html" />
<load target="css/config.css" />
<form class="x_form-horizontal" action="./" method="post" id="advanced_mailer">
<input type="hidden" name="module" value="advanced_mailer" />
<input type="hidden" name="act" value="procAdvanced_mailerAdminInsertExceptions" />
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_sending_method_default}</label>
<div class="x_controls margin-top">
{$sending_methods[$sending_method]['name']}
<!--@if($sending_method === 'woorimail')-->
<!--@if(config('mail.woorimail.api_type') === 'free')-->
({$lang->cmd_advanced_mailer_api_type_free})
<!--@else-->
({$lang->cmd_advanced_mailer_api_type_paid})
<!--@end-->
<!--@end-->
</div>
</div>
</section>
<!--@for($i = 1; $i <= 3; $i++)-->
<section class="section">
<h2 style="padding-top:12px">{$lang->cmd_advanced_mailer_exception_group} {$i}</h2>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_exception_{$i}_method">{$lang->cmd_advanced_mailer_sending_method}</label>
<div class="x_controls">
<select name="exception_{$i}_method" id="advanced_mailer_exception_{$i}_method">
<option value="default">{$lang->cmd_advanced_mailer_exception_disabled}</option>
<!--@foreach($sending_methods as $driver_name => $driver_definition)-->
<option value="{$driver_name}" selected="selected"|cond="$advanced_mailer_config->exceptions[$i]['method'] === $driver_name">{$driver_definition['name']}</option>
<!--@end-->
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_exception_{$i}_domains">{$lang->cmd_advanced_mailer_exception_domains_list}</label>
<div class="x_controls">
<textarea name="exception_{$i}_domains" id="advanced_mailer_exception_{$i}_domains" class="exception-domains">{implode(', ', $advanced_mailer_config->exceptions[$i]['domains'])}</textarea>
<p class="x_help-block">{$lang->cmd_advanced_mailer_about_exception_domains_list}</p>
</div>
</div>
</section>
<!--@end-->
<div style="margin-top:32px">
※ {$lang->cmd_advanced_mailer_about_exception_domains}
</div>
<div class="btnArea x_clearfix">
<button type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_registration}</button>
</div>
</form>

View file

@ -0,0 +1,106 @@
(function($) {
$(function() {
$("#advanced_mailer_sending_method").on("change", function() {
var sending_method = $(this).val();
$("div.x_control-group.hidden-by-default").not(".show-always").each(function() {
if ($(this).hasClass("show-for-" + sending_method)) {
$(this).show();
} else {
$(this).hide();
}
});
var reply_to = $("#advanced_mailer_reply_to").parents("div.x_control-group");
if (sending_method === "woorimail") {
reply_to.hide();
} else {
reply_to.show();
}
}).triggerHandler("change");
$("#advanced_mailer_smtp_manual_entry").on("change", function() {
var auto_fill = $(this).val();
if (auto_fill === 'gmail') {
$("#advanced_mailer_smtp_host").val('smtp.gmail.com');
$("#advanced_mailer_smtp_port").val('465');
$("#advanced_mailer_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_tls").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'hanmail') {
$("#advanced_mailer_smtp_host").val('smtp.daum.net');
$("#advanced_mailer_smtp_port").val('465');
$("#advanced_mailer_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_tls").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'naver') {
$("#advanced_mailer_smtp_host").val('smtp.naver.com');
$("#advanced_mailer_smtp_port").val('587');
$("#advanced_mailer_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_ssl").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'worksmobile') {
$("#advanced_mailer_smtp_host").val('smtp.worksmobile.com');
$("#advanced_mailer_smtp_port").val('587');
$("#advanced_mailer_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_ssl").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'outlook') {
$("#advanced_mailer_smtp_host").val('smtp-mail.outlook.com');
$("#advanced_mailer_smtp_port").val('587');
$("#advanced_mailer_smtp_security_tls").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_ssl").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
if (auto_fill === 'yahoo') {
$("#advanced_mailer_smtp_host").val('smtp.mail.yahoo.com');
$("#advanced_mailer_smtp_port").val('465');
$("#advanced_mailer_smtp_security_ssl").prop("checked", true).parent().addClass("checked");
$("#advanced_mailer_smtp_security_tls").parent().removeClass("checked");
$("#advanced_mailer_smtp_security_none").parent().removeClass("checked");
$("#advanced_mailer_force_sender").prop("checked", true).parent().addClass("checked");
}
});
$("#advanced_mailer_woorimail_account_type_free,#advanced_mailer_woorimail_account_type_paid").on("change", function() {
if ($("#advanced_mailer_woorimail_account_type_paid").is(":checked")) {
$("#advanced_mailer_reply_to").attr("disabled", "disabled");
} else {
$("#advanced_mailer_reply_to").removeAttr("disabled");
}
}).triggerHandler("change");
$("#advanced_mailer_test_send").click(function(event) {
event.preventDefault();
$("#advanced_mailer_test_result").text("");
$(this).attr("disabled", "disabled");
var ajax_data = {
recipient_name: $("#advanced_mailer_recipient_name").val(),
recipient_email: $("#advanced_mailer_recipient_email").val(),
};
$.exec_json(
"advanced_mailer.procAdvanced_mailerAdminTestSend", ajax_data,
function(response) {
$("#advanced_mailer_test_result").html(response.test_result);
$("#advanced_mailer_test_send").removeAttr("disabled");
},
function(response) {
$("#advanced_mailer_test_result").text("AJAX Error");
$("#advanced_mailer_test_send").removeAttr("disabled");
}
);
});
});
} (jQuery));

View file

@ -0,0 +1,43 @@
(function($) {
$(function() {
$("#advanced_mailer_check_spf,#advanced_mailer_check_dkim").click(function(event) {
event.preventDefault();
var check_type = $(this).attr("id").match(/_spf$/) ? "spf" : "dkim";
var check_hostname = $(this).siblings("span.monospace").text();
if (!check_hostname) {
alert($("#spf_dkim_setting").data("nothing-to-check"));
}
$(this).attr("disabled", "disabled");
$.exec_json(
"advanced_mailer.procAdvanced_mailerAdminCheckDNSRecord",
{ hostname: check_hostname, record_type: "TXT" },
function(response) {
if (response.record_content === false) {
alert($("#spf_dkim_setting").data("check-failure"));
}
else if (response.record_content === "") {
alert('<span class="monospace">' + check_hostname + "</span> " +
$("#spf_dkim_setting").data("check-no-records"));
$(".x_modal._common._small").removeClass("_small");
}
else {
alert('<span class="monospace">' + check_hostname + "</span> " +
$("#spf_dkim_setting").data("check-result") + "<br /><br />" +
'<div class="monospace">' + response.record_content.replace("\n", "<br />") + "</div>");
$(".x_modal._common._small").removeClass("_small");
}
$("#advanced_mailer_check_" + check_type).removeAttr("disabled");
},
function(response) {
alert($("#spf_dkim_setting").data("check-failure"));
$("#advanced_mailer_check_" + check_type).removeAttr("disabled");
}
);
});
});
} (jQuery));

View file

@ -0,0 +1,15 @@
(function($) {
$(function() {
$("a.show-errors").click(function(event) {
event.preventDefault();
var error_msg = $(this).siblings("div.mail-log-errors").html();
alert(error_msg);
$(".x_modal._common._small").removeClass("_small");
});
});
} (jQuery));

View file

@ -0,0 +1,127 @@
<include target="./common.html" />
<load target="css/spf_dkim.css" />
<load target="js/spf_dkim.js" />
<div id="spf_dkim_setting" class="x_form-horizontal"
data-nothing-to-check="{$lang->cmd_advanced_mailer_nothing_to_check}"
data-check-no-records="{$lang->cmd_advanced_mailer_check_no_records}"
data-check-failure="{$lang->cmd_advanced_mailer_check_failure}"
data-check-result="{$lang->cmd_advanced_mailer_check_result}">
<div class="advanced_mailer_description">
※ {$lang->cmd_advanced_mailer_about_spf_dkim_setting}
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_sending_method_default}</label>
<div class="x_controls margin-top">
{$sending_methods[$sending_method]['name']}
<!--@if($sending_method === 'woorimail')-->
<!--@if(config('mail.woorimail.api_type') === 'free')-->
({$lang->cmd_advanced_mailer_api_type_free})
<!--@else-->
({$lang->cmd_advanced_mailer_api_type_paid})
<!--@end-->
<!--@end-->
</div>
</div>
<div class="x_control-group" cond="count($used_methods) > 1">
<label class="x_control-label">{$lang->cmd_advanced_mailer_sending_method_exceptions}</label>
<div class="x_controls">
<!--@foreach($advanced_mailer_config->exceptions as $exception)-->
<!--@if(in_array($exception['method'], $used_methods))-->
<div class="spf_dkim_item">
{$sending_methods[$exception['method']]['name']}
<!--@if($exception['method'] === 'woorimail')-->
<!--@if(config('mail.woorimail.api_type') === 'free')-->
({$lang->cmd_advanced_mailer_api_type_free})
<!--@else-->
({$lang->cmd_advanced_mailer_api_type_paid})
<!--@end-->
<!--@end-->
&mdash; {sprintf($lang->cmd_advanced_mailer_domain_count, count($exception['domains']))}
</div>
<!--@end-->
<!--@end-->
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_sender_email}</label>
<div class="x_controls margin-top">{$advanced_mailer_config->sender_email}</div>
</div>
{@ $ignore_domains = '/^(g(oogle)?mail\.com|(daum|hanmail2?)\.net|(naver|outlook|hotmail|yahoo)\.com|(hotmail|yahoo)\.co\.kr)$/i'}
<div class="x_control-group">
<label class="x_control-label">SPF</label>
<div class="x_controls">
<!--@if(preg_match($ignore_domains, $sending_domain))-->
<div class="spf_dkim_item">
{$lang->cmd_advanced_mailer_not_applicable_because_sender_domain}
</div>
<!--@elseif(!count($used_methods_with_usable_spf))-->
<div class="spf_dkim_item">
{$lang->cmd_advanced_mailer_not_applicable_because_sending_method}
</div>
<!--@else-->
<div class="spf_dkim_item">
<span class="label">{$lang->cmd_advanced_mailer_dns_hostname}</span>
<span class="monospace">{$sending_domain}</span> &nbsp;
<a href="#" id="advanced_mailer_check_spf">{$lang->cmd_advanced_mailer_check}</a>
</div>
<div class="spf_dkim_item">
<span class="label">{$lang->cmd_advanced_mailer_txt_record}</span>
<span class="monospace">v=spf1 a mx {implode(' ', $used_methods_with_usable_spf)} ~all</span>
</div>
{@ $other_infos = array()}
<!--@foreach($used_methods_with_usable_spf as $method => $spf)-->
{@ $other_info = Context::getLang('cmd_advanced_mailer_other_info_' . $method . '_spf')}
{@ if(strncmp('cmd_', $other_info, 4)) $other_infos[] = $other_info}
<!--@end-->
<div class="spf_dkim_item" cond="count($other_infos)">
<!--@foreach($other_infos as $other_info)-->
<span class="label">{$lang->cmd_advanced_mailer_other_info}</span>
<span>{$other_info}</span><br />
<!--@end-->
</div>
<!--@end-->
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">DKIM</label>
<div class="x_controls">
<!--@if(preg_match($ignore_domains, $sending_domain))-->
<div class="spf_dkim_item">
{$lang->cmd_advanced_mailer_not_applicable_because_sender_domain}
</div>
<!--@elseif(!count($used_methods_with_usable_dkim))-->
<div class="spf_dkim_item">
{$lang->cmd_advanced_mailer_not_applicable_because_sending_method}
</div>
<!--@else-->
<!--@foreach($used_methods_with_usable_dkim as $method => $dkim)-->
<div class="spf_dkim_item">
<span class="label">{$lang->cmd_advanced_mailer_dns_hostname}</span>
<span class="monospace">{$dkim}.{$sending_domain}</span> &nbsp;
<a href="#" id="advanced_mailer_check_spf">{$lang->cmd_advanced_mailer_check}</a>
</div>
<div class="spf_dkim_item">
<span class="label">{$lang->cmd_advanced_mailer_txt_record}</span>
<span class="monospace">v=DKIM1; k=rsa; p=MIGfMA...{$lang->cmd_advanced_mailer_ellipsis}...QAB;</span>
</div>
{@ $other_info = Context::getLang('cmd_advanced_mailer_other_info_' . $method . '_dkim')}
{@ if(!strncmp('cmd_', $other_info, 4)) $other_info = false}
<div class="spf_dkim_item" cond="$other_info">
<span class="label">{$lang->cmd_advanced_mailer_other_info}</span>
<span>{$other_info}</span><br />
</div>
<div class="spf_dkim_separator"></div>
<!--@end-->
<!--@end-->
</div>
</div>
</div>

View file

@ -0,0 +1,45 @@
<include target="./common.html" />
<load target="css/config.css" />
<load target="js/config.js" />
<form class="x_form-horizontal" action="./" method="post" id="advanced_mailer">
<input type="hidden" name="module" value="advanced_mailer" />
<input type="hidden" name="act" value="procAdvanced_mailerAdminTestConfig" />
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<section class="section">
<h2>{$lang->cmd_advanced_mailer_test}</h2>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_recipient_name">{$lang->cmd_advanced_mailer_recipient_name}</label>
<div class="x_controls">
<input type="text" id="advanced_mailer_recipient_name" value="{Context::get('logged_info')->nick_name}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="advanced_mailer_recipient_email">{$lang->cmd_advanced_mailer_recipient_email}</label>
<div class="x_controls">
<input type="text" id="advanced_mailer_recipient_email" value="{Context::get('logged_info')->email_address}" />
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_advanced_mailer_test_result}</label>
<div class="x_controls">
<div id="advanced_mailer_test_result"></div>
</div>
</div>
</section>
<div class="btnArea x_clearfix">
<button id="advanced_mailer_test_send" type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_advanced_mailer_send}</button>
</div>
</form>

View file

@ -0,0 +1,84 @@
<include target="./common.html" />
<load target="css/view_log.css" />
<load target="js/view_log.js" />
<table id="advanced_mailer_log" class="x_table x_table-striped x_table-hover">
<caption>
<strong>Total: {number_format($total_count)}, Page: {number_format($page)}/{number_format($total_page)}</strong>
</caption>
<thead>
<tr>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_sender}</th>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_recipient}</th>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_subject}</th>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_sending_method}</th>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status_time}</th>
<th scope="col" class="nowr">{$lang->cmd_advanced_mailer_status}</th>
</tr>
</thead>
<tbody>
<tr loop="$advanced_mailer_log => $mail_id, $val">
<td class="nowr">
<!--@foreach($val->mail_from as $no => $mail_from)-->
<span title="{htmlspecialchars($mail_from[1])}">{htmlspecialchars($mail_from[0])}</span><br />
<!--@end-->
</td>
<td class="nowr">
<!--@foreach($val->mail_to as $no => $mail_to)-->
<span class="hidden"|cond="$no > 0" title="{htmlspecialchars($mail_to[1])}">{htmlspecialchars($mail_to[0])}</span>
<span class="show-hidden-recipients" cond="$no == 0 && count($val->mail_to) > 1">+{count($val->mail_to) - 1}</span>
<br />
<!--@end-->
</td>
<td class="nowr">{htmlspecialchars($val->subject)}</td>
<td class="nowr">
{Context::getLang('cmd_advanced_mailer_sending_method_' . $val->sending_method)}
</td>
<td class="nowr">{(zdate($val->regdate, "Y-m-d\nH:i:s"))}</td>
<td class="nowr">
<!--@if($val->status === 'success')-->
{$lang->cmd_advanced_mailer_status_success}
<!--@else-->
<a href="javascript:void(0)" class="show-errors">{$lang->cmd_advanced_mailer_status_error}</a>
<div class="mail-log-errors">
<strong>{$lang->cmd_advanced_mailer_status_error_msg}:</strong><br />
{nl2br(htmlspecialchars(trim($val->errors)))}<br /><br />
<strong>{$lang->cmd_advanced_mailer_status_calling_script}:</strong><br />
{htmlspecialchars($val->calling_script)}
</div>
<!--@end-->
</td>
</tr>
<tr cond="!$advanced_mailer_log">
<td>{$lang->msg_advanced_mailer_log_is_empty}</td>
</tr>
</tbody>
</table>
<div class="x_clearfix">
<form class="x_pagination x_pull-left" style="margin-top:8px" action="{Context::getUrl('')}" method="post" no-error-return-url="true">
<input loop="$param => $key, $val" cond="!in_array($key, array('mid', 'vid', 'act'))" type="hidden" name="{$key}" value="{$val}" />
<ul>
<li class="x_disabled"|cond="$page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>
<!--@while($page_no = $page_navigation->getNextPage())-->
<li class="x_active"|cond="$page_no == $page"><a href="{getUrl('page', $page_no)}">{$page_no}</a></li>
<!--@end-->
<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}">{$lang->last_page} &raquo;</a></li>
</ul>
</form>
<form class="x_pull-right x_input-append" style="margin-top:8px" action="{Context::getUrl('')}" method="post">
<input type="hidden" name="module" value="advanced_mailer" />
<input type="hidden" name="act" value="procAdvanced_mailerAdminClearSentMail" />
<input type="hidden" name="status" value="{$advanced_mailer_status}" />
<select name="clear_before_days" style="width:120px">
<option value="0">{$lang->cmd_advanced_mailer_clear_log_condition_all}</option>
<option value="1">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 1)}</option>
<option value="3">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 3)}</option>
<option value="7" selected="selected">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 7)}</option>
<option value="14">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 14)}</option>
<option value="30">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 30)}</option>
<option value="60">{sprintf($lang->cmd_advanced_mailer_clear_log_condition, 60)}</option>
</select>
<button class="x_btn" type="submit" disabled="disabled"|cond="!count($advanced_mailer_log)">{$lang->cmd_advanced_mailer_clear_log_button}</button>
</form>
</div>