first commit

This commit is contained in:
Your Name
2021-04-20 11:13:47 +05:30
parent b76859a3f1
commit 0a18b88eba
408 changed files with 47723 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mail Module for OpenConf</title>
<style type="text/css">
body { font-family: arial, helvetica, sans-serif; font-size: 80%; }
</style>
</head>
<body>
<h1>Mail Module for OpenConf</h1>
<p>This module adds support for using an external SMTP server in addition to the built-in PHP mail() function. The PHPMailer library is required and must be separately installed.</p>
<h3>Requirements</h3>
<p>The <a href="https://github.com/PHPMailer/PHPMailer" target="_blank">PHPMailer</a> library must be installed to the plugins/PHPMailer/ directory so that (for PHPMailer version 6+) the PHPMailer.php file is found at plugins/PHPMailer/src/PHPMailer.php or plugins/PHPMailer/PHPMailer.php. In order to use PHPMailer from another directory, modify the MOD_MAIL_PHPMAILER_DIR constant in the module.inc file.</p>
<p>For PHPMailer &lt;= 5.2, the file PHPMailerAutoload.php must be in plugins/PHPMailer/PHPMailerAutoload.php, and module/mail/module.inc edited to remove the two <i>use</i> lines atop the file.</p>
<p>The SMTP server must support multiple repeated connections. For example, if the Chair is sending an email to all contact authors and there are 100 submissions, the SMTP server will receive 100 connections, one after the other. If the SMTP server is slow, does rate limiting, or PHP is configured with a short script execution time, messages may fail.</p>
<h3>Configuration</h3>
<p>Mail options are defined via this module's settings. PHPMailer must be installed prior to accessing the settings.</p>
<p>If possible, enter the SMTP server's IP address for the SMTP Host to speed up processing by saving the DNS lookup.</p>
<p>A link is displayed at the bottom of the module's settings page to send a test message using the active mailer.</p>
<h3>Usage</h3>
<p>Once configured, this module works without user intervention.</p>
<h3>Note</h3>
<p>The SMTP server account username and password may optionally be set directly atop the module.inc file found in the module's directory -- see the section // SMTP Auth.</p>
<hr />
<p>Version 1.0.1<br />
- Updated to support PHPMailer 6
</p>
<p>Version 1.0.0<br />
- Initial Release</p>
</body>
</html>
View File
View File
+24
View File
@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
//// Add hooks
// Mail
if ($OC_configAR['MOD_MAIL_mailer'] == 'smtp') {
oc_addHook('mail', '../modules/mail/mail.inc');
}
// Chair settings
oc_addHook('chair-menu-settings-modules', array($OC_modulesAR[$moduleId]['name'], '<a href="../modules/request.php?module=mail&action=settings.inc">Mail</a>'));
// Settings Export/Import
oc_addHook('settings-export-options', '../modules/mail/settings-export-options.inc');
oc_addHook('settings-export-prep', '../modules/mail/settings-export-prep.inc');
+32
View File
@@ -0,0 +1,32 @@
## +----------------------------------------------------------------------+
## | OpenConf |
## +----------------------------------------------------------------------+
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
## +----------------------------------------------------------------------+
## | This source file is subject to the OpenConf License, available on |
## | the OpenConf web site: www.OpenConf.com |
## +----------------------------------------------------------------------+
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
## SQL statement.
# --------------------------------------------------------
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_mailer', 'php', 'Mailer', 'Mailer to use for sending messages, options: php (built-in PHP mail function), smtp (SMTP server)', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_from_email', '', 'From Email', 'Email address to use in From field. Leave blank for Chair Email Address', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_from_name', '', 'From Name', 'Name to use in From field. Leave blank for Event Short Name', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_return_path', 1, 'Return Path', 'Set return path to match From Email (1=Yes, 0=no)', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_host', '', 'SMTP Host', 'SMTP server name', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_port', '', 'SMTP Port', 'SMTP server port', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_encryption', 'none', 'SMTP Encryption', 'SMTP server encryption, options: none, ssl, tls', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_username', '', 'SMTP Username', 'SMTP server account username', 0);
INSERT INTO `config` (`module`, `setting`, `value`, `name`, `description`, `parse`) VALUES ('mail', 'MOD_MAIL_smtp_password', '', 'SMTP Password', 'SMTP server account password', 0);
+98
View File
@@ -0,0 +1,98 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
// Use $hdr if set?
$usehdr = 1; // 0=no, 1=set Reply-To to $hdr:From, 2=set Reply-To and From to $hdr:From
$mod_mail = $GLOBALS['mod_mail_phpmailer'];
// Setup PHPMailer if not already configured
if ($mod_mail->Mailer != 'smtp') {
// From name/address to use
if (empty($OC_configAR['MOD_MAIL_from_name'])) {
$from_name = $OC_configAR['OC_confName'];
} else {
$from_name = $OC_configAR['MOD_MAIL_from_name'];
}
if (empty($OC_configAR['MOD_MAIL_from_email'])) {
$from_email = $OC_configAR['OC_pcemail'];
} else {
$from_email = $OC_configAR['MOD_MAIL_from_email'];
}
// $hdr set?
if ( isset($hdr) && ($usehdr > 0) && preg_match("/From: \"?([^\"<]+)\"?\s?<([^>]+)>/", $hdr, $matches) && !empty($matches[1]) && validEmail($matches[2])) {
$reply_name = $matches[1];
$reply_email = $matches[2];
if ($usehdr == 2) {
$from_name = $reply_name;
$from_email = $reply_email;
}
} else {
$reply_name = $from_name;
$reply_email = $from_email;
}
// Setup
$mod_mail->isSMTP();
$mod_mail->Host = $OC_configAR['MOD_MAIL_smtp_host'];
$mod_mail->Port = $OC_configAR['MOD_MAIL_smtp_port'];
if (!empty($OC_configAR['MOD_MAIL_smtp_username']) && !empty($OC_configAR['MOD_MAIL_smtp_password'])) {
if (!isset($GLOBALS['mod_mail_smtp_password'])) {
$GLOBALS['mod_mail_smtp_password'] = oc_decrypt($OC_configAR['MOD_MAIL_smtp_password']);
}
$mod_mail->SMTPAuth = true;
$mod_mail->Username = $OC_configAR['MOD_MAIL_smtp_username'];
$mod_mail->Password = $GLOBALS['mod_mail_smtp_password'];
} elseif (defined('MOD_MAIL_SMTP_USERNAME') && defined('MOD_MAIL_SMTP_PASSWORD')) {
$mod_mail->SMTPAuth = true;
$mod_mail->Username = MOD_MAIL_SMTP_USERNAME;
$mod_mail->Password = MOD_MAIL_SMTP_PASSWORD;
} else {
$mod_mail->SMTPAuth = false;
}
if ($OC_configAR['MOD_MAIL_smtp_encryption'] != 'none') {
$mod_mail->SMTPSecure = $OC_configAR['MOD_MAIL_smtp_encryption'];
}
$mod_mail->setFrom($from_email, $from_name, ($OC_configAR['MOD_MAIL_return_path'] ? true : false));
$mod_mail->addReplyTo($reply_email, $reply_name);
$mod_mail->CharSet = 'UTF-8';
$mod_mail->WordWrap = $OC_configAR['OC_emailWrap'];
if ($GLOBALS['mod_mail_debug']) {
$mod_mail->SMTPDebug = $GLOBALS['mod_mail_debug'];
$mod_mail->Debugoutput = 'html';
}
$GLOBALS['mod_mail_phpmailer'] = $mod_mail;
}
// Addresse(es)
if ($to_emails = preg_split("/,/", $to)) {
foreach($to_emails as $address) {
$mod_mail->addAddress($address);
}
} else {
$mod_mail->addAddress($to);
}
// Subject & Body
$mod_mail->Subject = $subject;
$mod_mail->Body = $body;
// Send it
if ($mod_mail->send()) {
$mod_mail->clearAddresses();
return(true);
} else {
$mod_mail->clearAddresses();
oc_logit('email-smtp', 'SMTP Failure to ' . $to . ' -- ' . $mod_mail->ErrorInfo);
return(false);
}
+54
View File
@@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
// SMTP Auth -- server account credentials, define below to avoid storing in database
# define('MOD_MAIL_SMTP_USERNAME', '');
# define('MOD_MAIL_SMTP_PASSWORD', '');
use PHPMailer\PHPMailer\PHPMailer; // comment out or remove if PHPMailer <= 5.2
use PHPMailer\PHPMailer\Exception; // comment out or remove if PHPMailer <= 5.2
// Module ID - needs to match directory name
$moduleId = 'mail';
// Module info
$OC_modulesAR[$moduleId] = array(
'name' => 'Mail',
'description' => 'Provides support for using an external SMTP server',
'version' => '1.0.1',
'dependencies' => array(),
'developer' => 'OpenConf'
);
// PHPMailer plugin directory
if (!defined('MOD_MAIL_PHPMAILER_DIR')) {
define('MOD_MAIL_PHPMAILER_DIR', OCC_PLUGINS_DIR . 'PHPMailer/');
}
// PHPMailer loader
$GLOBALS['mod_mail_phpmailer'] = false;
$GLOBALS['mod_mail_debug'] = 0;
if ($OC_configAR['MOD_MAIL_mailer'] == 'smtp') {
if (is_file(MOD_MAIL_PHPMAILER_DIR . 'src/PHPMailer.php')) { // >= 6
require_once MOD_MAIL_PHPMAILER_DIR . 'src/PHPMailer.php';
require_once MOD_MAIL_PHPMAILER_DIR . 'src/Exception.php';
require_once MOD_MAIL_PHPMAILER_DIR . 'src/SMTP.php';
} elseif (is_file(MOD_MAIL_PHPMAILER_DIR . 'PHPMailer.php')) { // >= 6 (no src/)
require_once MOD_MAIL_PHPMAILER_DIR . 'PHPMailer.php';
require_once MOD_MAIL_PHPMAILER_DIR . 'Exception.php';
require_once MOD_MAIL_PHPMAILER_DIR . 'SMTP.php';
} elseif (is_file(MOD_MAIL_PHPMAILER_DIR . 'PHPMailerAutoload.php')) { // <= 5.2 | comment out use statements above
require_once MOD_MAIL_PHPMAILER_DIR . 'PHPMailerAutoload.php';
} else {
err('Mail SMTP set, however plugin not found; see Mail module info page for requirements');
}
$GLOBALS['mod_mail_phpmailer'] = new PHPMailer;
}
+16
View File
@@ -0,0 +1,16 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
print '
<br />
<label><input type="checkbox" name="settings[]" value="mail" /> Mail - Configuration</label><br />
';
+15
View File
@@ -0,0 +1,15 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
if (in_array('mail', $_POST['settings'])) {
$settings['modules']['mail'] = $OC_modulesAR['mail']['name'];
$oc_encryptedSettingsAR[] = 'mail:MOD_MAIL_smtp_password';
}
+167
View File
@@ -0,0 +1,167 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
// Check for PHPMailer
if (!is_dir(MOD_MAIL_PHPMAILER_DIR)) {
warn('PHPMailer plugin is missing. <a href="https://github.com/PHPMailer/PHPMailer" target="_blank" rel="noopener noreferrer">Download</a> and install it to the directory plugins/PHPMailer/.');
exit;
}
$MOD_MAIL_configVars = array('MOD_MAIL_mailer', 'MOD_MAIL_from_email', 'MOD_MAIL_from_name', 'MOD_MAIL_return_path', 'MOD_MAIL_smtp_host', 'MOD_MAIL_smtp_port', 'MOD_MAIL_smtp_encryption');
if (!defined('MOD_MAIL_SMTP_USERNAME')) {
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_username';
}
$mod_mail_mailerOptions = array(
'php' => 'PHP mail() function',
'smtp' => 'SMTP server'
);
$mod_mail_encryptionOptions = array(
'none' => 'none',
'ssl' => 'SSL',
'tls' => 'TLS'
);
$mod_mail_returnPathOptions = array(
'1' => 'use From Email',
'0' => 'do not set'
);
$err = array();
// Save settings?
if (isset($_POST['submit']) && ($_POST['submit'] == 'Save Settings')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Check input
if (!isset($_POST['MOD_MAIL_mailer']) || !isset($mod_mail_mailerOptions[$_POST['MOD_MAIL_mailer']])) {
$err[] = 'Mailer invalid';
} elseif (($_POST['MOD_MAIL_mailer'] == 'smtp') && (empty(trim($_POST['MOD_MAIL_smtp_host'])) || empty(trim($_POST['MOD_MAIL_smtp_port'])))) {
$err[] = 'SMTP Host and Port must be filled in when SMTP selected';
}
if (!empty($_POST['MOD_MAIL_from_email']) && !validEmail(trim($_POST['MOD_MAIL_from_email']))) {
$err[] = 'From Email invalid';
}
if (!isset($_POST['MOD_MAIL_return_path']) || !isset($mod_mail_returnPathOptions[$_POST['MOD_MAIL_return_path']])) {
$err[] = 'Return Path invalid';
}
if (!empty($_POST['MOD_MAIL_smtp_port']) && !preg_match("/^\d+$/", $_POST['MOD_MAIL_smtp_port'])) {
$err[] = 'SMTP Port invalid';
}
if (!isset($_POST['MOD_MAIL_smtp_encryption']) || !isset($mod_mail_encryptionOptions[$_POST['MOD_MAIL_smtp_encryption']])) {
$err[] = 'Encryption invalid';
}
if (!empty($err)) {
print '<div class="warn"><p>Please re-enter your settings, noting the following:</p><ul><li>' . implode('</li><li>', $err) . '</li></ul></div><br /><hr /><br />';
} else {
if (
isset($_POST['MOD_MAIL_smtp_password'])
&& ($_POST['MOD_MAIL_smtp_password'] != '***')
&& !empty($_POST['MOD_MAIL_smtp_password'])
) {
$_POST['MOD_MAIL_smtp_password'] = oc_encrypt($_POST['MOD_MAIL_smtp_password']);
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_password';
}
elseif (
!empty($OC_configAR['MOD_MAIL_smtp_password'])
&&
(!isset($_POST['MOD_MAIL_smtp_password']) || ($_POST['MOD_MAIL_smtp_password'] == ''))
) {
$_POST['MOD_MAIL_smtp_password'] = '';
$MOD_MAIL_configVars[] = 'MOD_MAIL_smtp_password';
}
// Update config settings
updateAllConfigSettings($MOD_MAIL_configVars, $_POST, OCC_MODULE_ID);
// notify user
print '<p style="text-align: center" class="note">Settings Saved</p>';
}
} else {
foreach ($MOD_MAIL_configVars as $var) {
$_POST[$var] = $OC_configAR[$var];
}
$_POST['MOD_MAIL_smtp_password'] = $OC_configAR['MOD_MAIL_smtp_password'];
}
// Show settings
print '
<form method="post" action="' . OCC_SELF . '" class="ocform occonfigform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<script>
document.write(\'<p style="margin: 0 0 2em 1em;"><span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(0)">collapse all</span> &nbsp; &nbsp; <span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(1)">expand all</span></p>\');
</script>
<fieldset id="oc_fs_mod_mail_main">
<legend onclick="oc_fsToggle(this)">Mailer <span>(collapse)</span></legend>
<div id="oc_fs_mod_mail_main_div">
<div class="field"><label for="MOD_MAIL_mailer">Mailer:</label>
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_mailer', $mod_mail_mailerOptions, varValue('MOD_MAIL_mailer', $_POST)) . '</fieldset><div class="fieldnote note"><br />If selecting SMTP server, fill out section below</div>
</div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
<fieldset id="oc_fs_mod_mail_smtp">
<legend onclick="oc_fsToggle(this)">SMTP Server Options <span>(collapse)</span></legend>
<div id="oc_fs_mod_mail_smtp_div">
<div class="field"><label for="MOD_MAIL_smtp_host">SMTP Host:</label> <input name="MOD_MAIL_smtp_host" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_host', $_POST)) . '" /><div class="fieldnote note">The use of an IP address is recommended</div></div>
<div class="field"><label for="MOD_MAIL_smtp_port">SMTP Port:</label> <input name="MOD_MAIL_smtp_port" class="ocinput" size="6" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_port', $_POST)) . '" /></div>
<div class="field"><label for="MOD_MAIL_smtp_encryption">Encryption:</label>
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_smtp_encryption', $mod_mail_encryptionOptions, varValue('MOD_MAIL_smtp_encryption', $_POST)) . '</fieldset>
</div>
';
if (!defined('MOD_MAIL_SMTP_USERNAME')) {
print '
<div class="field"><label for="MOD_MAIL_smtp_username">Username:</label> <input name="MOD_MAIL_smtp_username" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_smtp_username', $_POST)) . '" /><div class="fieldnote note">Leave username and password blank if server does not require authentication</div></div>
<div class="field"><label for="MOD_MAIL_smtp_password">Password:</label> <input name="MOD_MAIL_smtp_password" class="ocinput" size="80" value="' . ((empty($err) && !empty($OC_configAR['MOD_MAIL_smtp_password'])) ? '***' : varValue('MOD_MAIL_smtp_password', $_POST)) . '" /><div class="fieldnote note">If password saved, *** will display above</div></div>';
}
print '
<div class="field"><label for="MOD_MAIL_return_path">Return Path:</label>
<fieldset class="radio">' . generateRadioOptions('MOD_MAIL_return_path', $mod_mail_returnPathOptions, varValue('MOD_MAIL_return_path', $_POST)) . '</fieldset>
</div>
<div class="field"><label for="MOD_MAIL_from_name">From Name:</label> <input name="MOD_MAIL_from_name" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_from_name', $_POST)) . '" /><div class="fieldnote note">Leave blank to use Event/Journal Short Name</div></div>
<div class="field"><label for="MOD_MAIL_from_email">From Email:</label> <input name="MOD_MAIL_from_email" class="ocinput" size="80" value="' . safeHTMLstr(varValue('MOD_MAIL_from_email', $_POST)) . '" /><div class="fieldnote note">Leave blank to use Chair Email Address</div></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
</form>
';
if (($OC_configAR['MOD_MAIL_mailer'] == 'php') || (($OC_configAR['MOD_MAIL_mailer'] == 'smtp') && !empty($OC_configAR['MOD_MAIL_smtp_host']))) {
print '
<p style="font-style: italic;">Once settings are saved, <a href="../modules/request.php?module=mail&action=test.php" onclick="window.open(\'../modules/request.php?module=mail&action=test.php\', \'mail\',\'width=700,height=300,toolbar=0,status=0,menubar=0,resizable=1,scrollbars=1,location=0\'); return false;" title="opens new window to send a test message">test by sending a message</a></p>
<p>For troubleshooting assistance, see our <a href="https://www.openconf.com/documentation/email.php#troubleshooting" title="opens guide in new window" target="_blank">email guide</a>. If the SMTP mailer is enabled, also see the <a href="https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting" title="opens wiki in new window" target="_blank" rel="noopener noreferrer">PHPMailer wiki</a>.</p>
';
}
+50
View File
@@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
beginChairSession();
print '<!DOCTYPE html>
<html lang="en">
<head>
<title>Send Test Message</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../openconf.css" />
</head>
<body>
<div class="mainbody">
';
if (isset($_POST['submit']) && ($_POST['submit'] == 'Send Message') && isset($_POST['email']) && validEmail($_POST['email'])) {
if (!validToken('chair')) {
print '<p class="err">invalid submission</p>';
} else {
$GLOBALS['mod_mail_debug'] = 3;
if (oc_mail($_POST['email'], 'Test Message', 'This is a test message.')) {
print '<p class="note2">Message sent successfully</p>';
} else {
print '<p class="warn">Message failed</p>';
}
}
print '<hr />';
}
print '
<form method="post" action="' . OCC_SELF . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Enter an email address to send a test message using the ' . safeHTMLstr($OC_configAR['MOD_MAIL_mailer']) . ' mailer to:</p>
<p><input type="email" size="50" name="email" placeholder="email address" autofocus value="' . safeHTMLstr(varValue('email', $_POST)) . '" /></p>
<p><input type="submit" name="submit" class="submit" value="Send Message" /></p>
</div>
</body>
</html>
';
?>
+15
View File
@@ -0,0 +1,15 @@
## +----------------------------------------------------------------------+
## | OpenConf |
## +----------------------------------------------------------------------+
## | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
## +----------------------------------------------------------------------+
## | This source file is subject to the OpenConf License, available on |
## | the OpenConf web site: www.OpenConf.com |
## +----------------------------------------------------------------------+
## NOTE: This file cannot contain a semi-colon (;) except at the end of a
## SQL statement.
# --------------------------------------------------------
DELETE FROM `config` WHERE `module`='mail';
View File
View File
@@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------+
// | OpenConf |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. |
// +----------------------------------------------------------------------+
// | This source file is subject to the OpenConf License, available on |
// | the OpenConf web site: www.OpenConf.com |
// +----------------------------------------------------------------------+
// encrypt pw
if (!empty($OC_configAR['MOD_MAIL_smtp_password'])) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(oc_encrypt($OC_configAR['MOD_MAIL_smtp_password'])) . "' WHERE `module`='mail' AND `setting`='MOD_MAIL_smtp_password' LIMIT 1");
}