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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3481180-2.patch | 1.2 KB | cmarrufo |
Issue fork mimemail-3481180
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
cmarrufo commentedAttached patch.
Comment #4
cmarrufo commentedComment #7
mark_fullmerThanks. This is a no-nonsense check for an edge case, so I have no problem adding this conditional. Merged -- will be included in the next release!