Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanner Email / Debug Error messages #7204

Merged
merged 5 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions locale/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"#-#-#-#-# messages.po (PACKAGE VERSION) #-#-#-#-#\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-08 14:45-0800\n"
"POT-Creation-Date: 2024-12-08 14:46-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -25,8 +25,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-12-08T22:45:34.521Z\n"
"PO-Revision-Date: 2024-12-08T22:45:34.522Z\n"
"POT-Creation-Date: 2024-12-08T22:46:39.101Z\n"
"PO-Revision-Date: 2024-12-08T22:46:39.102Z\n"
"Language: en\n"

msgid "Backup Database"
Expand Down Expand Up @@ -5083,6 +5083,9 @@ msgstr ""
msgid "SMTP Host is not setup, please visit the settings page"
msgstr ""

msgid "Church Email not set, please visit the settings page"
msgstr ""

msgid "Debug Email Connection"
msgstr ""

Expand Down
11 changes: 7 additions & 4 deletions src/v2/routes/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Service\MailChimpService;
use ChurchCRM\Slim\Middleware\Request\Auth\AdminRoleAuthMiddleware;
use ChurchCRM\Utils\LoggerUtils;
use PHPMailer\PHPMailer\PHPMailer;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
Expand Down Expand Up @@ -45,14 +46,18 @@ function testEmailConnectionMVC(Request $request, Response $response, array $arg
$mailer = new PHPMailer();
$message = '';

if (!empty(SystemConfig::getValue('sSMTPHost')) && !empty(ChurchMetaData::getChurchEmail())) {
if (empty(SystemConfig::getValue('sSMTPHost'))) {
$message = gettext('SMTP Host is not setup, please visit the settings page');
} elseif (empty(ChurchMetaData::getChurchEmail())) {
$message = gettext('Church Email not set, please visit the settings page');
} else {
$mailer->IsSMTP();
$mailer->CharSet = 'UTF-8';
$mailer->Timeout = intval(SystemConfig::getValue('iSMTPTimeout'));
$mailer->Host = SystemConfig::getValue('sSMTPHost');
if (SystemConfig::getBooleanValue('bSMTPAuth')) {
$mailer->SMTPAuth = true;
echo 'SMTP Auth Used </br>';
LoggerUtils::getAppLogger()->debug('SMTP Auth Used');
$mailer->Username = SystemConfig::getValue('sSMTPUser');
$mailer->Password = SystemConfig::getValue('sSMTPPass');
}
Expand All @@ -63,8 +68,6 @@ function testEmailConnectionMVC(Request $request, Response $response, array $arg
$mailer->addAddress(ChurchMetaData::getChurchEmail());
$mailer->Body = 'test email';
$mailer->Debugoutput = 'html';
} else {
$message = gettext('SMTP Host is not setup, please visit the settings page');
}

$pageArgs = [
Expand Down
Loading