HTML is not stripped due to incorrect schema for smtp_allowhtml

Created on 13 February 2023, over 1 year ago
Updated 10 April 2023, about 1 year ago

Problem/Motivation

The settings property smtp_allowhtml has a schema of string and a default value of an empty string, but the check for stripping tags uses this logic:

$this->AllowHtml = $this->smtpConfig->get('smtp_allowhtml');
if ($this->AllowHtml == 0){
  // ....
}

This will not execute as it is comparing '' == 0.

I have opened this as a new issue as I believe while very similar to #2771559 I believe 2771559 is requesting the opposite, which is adding functionality to smtp to format / send HTML mail.

This functionality is different, it is something that the core PHPMail class does and I believe should be fixed outside of whatever direction 2771559 ends in.

Steps to reproduce

  1. Install module
  2. Observe that "Allow to send e-mails formatted as HTML" is not selected on the settings page
  3. Send mail with HTML in it
  4. Observe that HTML is present in the recieved email

Proposed resolution

Convert schema from string to boolean
Fix if statement to just check !$this->AllowHtml

Remaining tasks

  1. Agree on approach

User interface changes

n/a

API changes

n/a

Data model changes

Change of schema from string to boolean.

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇳🇿New Zealand ericgsmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024