According to the documentation:
* Alter an email message created with MailManagerInterface->mail().
* Hook hook_mail_alter() allows modification of email messages created and sent
* with MailManagerInterface->mail(). Usage examples include adding and/or
* changing message text, message fields, and message headers.
* Email messages sent ...
Your problem is that you are using routeMatch() to get the node id, which won't be returned when using VBO.
You said you're using hook_entity_update():
function hook_ENTITY_TYPE_update(Drupal\Core\Entity\EntityInterface $entity)
This code assumes that the entity you are running hook_entity_update() for is the node entity.
Since the hook provides the $entity ...
All emails in Drupal are uniquely identified by their sending module and key. In the case of the welcome message for admin-created users, the sending module is user and the key is register_admin_created. This is all you need. The subject and the message body is defined by the sending module and you don't need access to it in order to send the message.
If you ...
Thanks for the guidance on this @dercheffe. I found what I needed in the config file user.mail.yml and was able to pull the strings outs as an array with :
$config_txt = \Drupal::config('user.mail')->get('register_admin_created');
However, I had the problem of how to replace the user and site variables in the strings from the config file.
Long story short,...
Assuming that each person is a representative for only one district, you basically have several different mailing lists-- one for each district.
So if you are using a mailing list like Mailchimp, you need to set up a different list for each district and then let people sign up to each list.
Doing this with a single list and filtering the list is going to get ...
I guess this should be possible via configuration API. Look for the suitable entry where the message body is saved, call it via the service to put it into a variable. Then you can do additional coding with the string variable.
More information you can find here:
Configuration override system in the docs