How to access langcode in a (custom) transport?

Created on 26 June 2024, 6 months ago

Problem/Motivation

I have managed to create a custom mailer transport that uses the customer's API for sending out emails. That API would like to know the "language" of the outgoing email - it does a language specific alternation on the email (I guess). Drupal's mail API allows passing a langcode as part of the $message array, but I do not see that information propagated to the Email() object. (

The email sending runs in the background via the queue_mail module, so probably it would not be a vise idea guessing the language from a global context.

Steps to reproduce

Proposed resolution

Pass the langcode information as a special header to lower layers, like the transport, like $email->getHeaders()->addTextHeader('X-Langcode', $message['langcode']);

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary mxr576 Hungary

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

Comments & Activities

Production build 0.71.5 2024