mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
mailtest show error msg
This commit is contained in:
@@ -316,7 +316,7 @@ class ToolRepository extends BaseRepository
|
||||
* @param $body
|
||||
* @return bool
|
||||
*/
|
||||
public function sendMail($to, $subject, $body): bool
|
||||
public function sendMail($to, $subject, $body, $exception = false): bool
|
||||
{
|
||||
$log = "[SEND_MAIL]";
|
||||
$factory = new EsmtpTransportFactory();
|
||||
@@ -353,7 +353,11 @@ class ToolRepository extends BaseRepository
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
do_log("$log, fail: " . $e->getMessage() . "\n" . $e->getTraceAsString(), 'error');
|
||||
return false;
|
||||
if ($exception) {
|
||||
throw $e;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.12');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-06-16');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-06-22');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -20,9 +20,14 @@ if ($action == "sendmail")
|
||||
EOD;
|
||||
|
||||
// sent_mail($email, $SITENAME, $SITEEMAIL, change_email_encode(get_langfolder_cookie(), $title), change_email_encode(get_langfolder_cookie(),$body), '', false, false, '', get_email_encode(get_langfolder_cookie()));
|
||||
sent_mail($email, $SITENAME, $SITEEMAIL, $title, $body, '', false, false, '', get_email_encode(get_langfolder_cookie()));
|
||||
|
||||
stderr($lang_mailtest['std_success'], $lang_mailtest['std_success_note']);
|
||||
// sent_mail($email, $SITENAME, $SITEEMAIL, $title, $body, '', false, false, '', get_email_encode(get_langfolder_cookie()));
|
||||
try {
|
||||
$toolRep = new \App\Repositories\ToolRepository();
|
||||
$toolRep->sendMail($email, $title, $body, true);
|
||||
stderr($lang_mailtest['std_success'], $lang_mailtest['std_success_note']);
|
||||
} catch (\Throwable $e) {
|
||||
stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail'] . sprintf("<br/><br/><code>%s</code>", $e->getMessage()), false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user