Problem/Motivation

Right now, all the custom headers are getting transformed to lowercase in SMTPMailSystem::mail() line 217:
$headers = array_change_key_case($message['headers']);

Totally makes sense to unify keys and apply checks.

In the end of switch/case, the default case adds the custom header as it is, but by that moment, the header is in lower case and the message client ignores it.
SMTPMailSystem::mail() line 478:
$mailer->AddCustomHeader($key . ': ' . $value);

E.g. if add 'In-Reply-To' in any hook_mail_alter(), the email client will receive it as 'in-reply-to' and will ignore it.
At least, the gmail ignores it.

Steps to reproduce

Add 'In-Reply-To' header in hook_mail_alter()

Proposed resolution

Unify the custom header with ucwords() and separator equal to '-'
$mailer->AddCustomHeader(ucwords($key, '-') . ': ' . $value);

The only header, so far, that does not follow the pattern Part1-Part2 is MessageID. Add case to set MessageID property if passed.

case 'messageid':
  $mailer->MessageID = $value;
  break;

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

Issue fork smtp-3374623

Command icon 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

id.rem.dev created an issue.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9 changed the visibility of the branch 8.x-1.x to hidden.