Warning: Undefined array key "Content-Type" in Drupal\mimemail\Plugin\Mail\MimeMail->format()

Created on 16 October 2024, 2 months ago

Problem/Motivation

In a new project I'm working on I get several error messages when sending an email:
Warning: Undefined array key "Content-Type" in Drupal\mimemail\Plugin\Mail\MimeMail->format() (line 91 of
modules/contrib/mimemail/src/Plugin/Mail/MimeMail.php).

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\mimemail\Plugin\Mail\MimeMail->format() (line 91 of modules/contrib/mimemail/src/Plugin/Mail/MimeMail.php).

In my case it's because the variable $message['headers']['Content-Type'] can be empty.

Proposed resolution

Check if the variable exists and add $matches to the preg_match function.

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain cmarrufo

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024