feat(emailer): Added ability to configure sendmail

This commit is contained in:
Roman Kelesidis 2025-03-11 14:03:52 +03:00
commit 5ad4a7019d
2 changed files with 9 additions and 8 deletions

View file

@ -435,11 +435,11 @@ $bb_cfg['invites_system'] = [
]; ];
$bb_cfg['password_symbols'] = [ $bb_cfg['password_symbols'] = [
// What symbols should be required in the password // What symbols should be required in the password
'nums' => true, // Numeric 'nums' => true,
'spec_symbols' => false, // Special symbols 'spec_symbols' => false,
'letters' => [ // Letters 'letters' => [
'uppercase' => true, // Uppercase letters 'uppercase' => false,
'lowercase' => true // Lowercase letters 'lowercase' => true
] ]
]; ];
$bb_cfg['password_hash_options'] = [ $bb_cfg['password_hash_options'] = [
@ -451,6 +451,7 @@ $bb_cfg['password_hash_options'] = [
// Email // Email
$bb_cfg['emailer'] = [ $bb_cfg['emailer'] = [
'enabled' => true, 'enabled' => true,
'sendmail_command' => '/usr/sbin/sendmail -bs',
'smtp' => [ 'smtp' => [
'enabled' => false, // send email via external SMTP server 'enabled' => false, // send email via external SMTP server
'host' => 'localhost', // SMTP server host 'host' => 'localhost', // SMTP server host

View file

@ -100,12 +100,12 @@ class Emailer
$tpl_file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/email/' . $template_file . '.html'; $tpl_file = LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/email/' . $template_file . '.html';
if (!is_file($tpl_file)) { if (!is_file($tpl_file)) {
bb_die('Could not find email template file: ' . $template_file); throw new Exception('Could not find email template file: ' . $template_file);
} }
} }
if (!$fd = fopen($tpl_file, 'rb')) { if (!$fd = fopen($tpl_file, 'rb')) {
bb_die('Failed opening email template file: ' . $tpl_file); throw new Exception('Failed opening email template file: ' . $tpl_file);
} }
$this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file)); $this->tpl_msg[$template_lang . $template_file] = fread($fd, filesize($tpl_file));
@ -159,7 +159,7 @@ class Emailer
$transport = new EsmtpTransport('localhost', 25); $transport = new EsmtpTransport('localhost', 25);
} }
} else { } else {
$transport = new SendmailTransport('/usr/sbin/sendmail -bs'); $transport = new SendmailTransport($bb_cfg['emailer']['sendmail_command']);
} }
$mailer = new Mailer($transport); $mailer = new Mailer($transport);