class SystemMailBuilder extends MailBuilder
{
/** @var string */
- protected $subject;
+ protected $subject = '';
/** @var string */
- protected $preamble;
+ protected $preamble = '';
/** @var string */
- protected $body;
+ protected $body = null;
/** @var string */
protected $siteAdmin;
*/
public function withMessage(string $subject, string $preamble, string $body = null)
{
- if (!isset($body)) {
- $body = $preamble;
- }
-
$this->subject = $subject;
$this->preamble = $preamble;
$this->body = $body;
*/
protected function getHtmlMessage()
{
- $htmlVersion = BBCode::convert($this->body);
+ $htmlVersion = !empty($this->body) ? BBCode::convert($this->body) : '';
// load the template for private message notifications
$tpl = Renderer::getMarkupTemplate('email/system/html.tpl');
*/
protected function getPlaintextMessage()
{
- $textVersion = BBCode::toPlaintext($this->body);
+ $textVersion = !empty($this->body) ? BBCode::toPlaintext($this->body) : '';
// load the template for private message notifications
$tpl = Renderer::getMarkupTemplate('email/system/text.tpl');