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'] = [
// What symbols should be required in the password
'nums' => true, // Numeric
'spec_symbols' => false, // Special symbols
'letters' => [ // Letters
'uppercase' => true, // Uppercase letters
'lowercase' => true // Lowercase letters
'nums' => true,
'spec_symbols' => false,
'letters' => [
'uppercase' => false,
'lowercase' => true
]
];
$bb_cfg['password_hash_options'] = [
@ -451,6 +451,7 @@ $bb_cfg['password_hash_options'] = [
// Email
$bb_cfg['emailer'] = [
'enabled' => true,
'sendmail_command' => '/usr/sbin/sendmail -bs',
'smtp' => [
'enabled' => false, // send email via external SMTP server
'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';
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')) {
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));
@ -159,7 +159,7 @@ class Emailer
$transport = new EsmtpTransport('localhost', 25);
}
} else {
$transport = new SendmailTransport('/usr/sbin/sendmail -bs');
$transport = new SendmailTransport($bb_cfg['emailer']['sendmail_command']);
}
$mailer = new Mailer($transport);